FS#10112 - Rockbox abort: search of title when the database is created by illegal codepage.

Attached to Project: Rockbox
Opened by Yoshihisa Uchida (Uchida) - Thursday, 09 April 2009, 13:19 GMT
Last edited by Yoshihisa Uchida (Uchida) - Friday, 28 May 2010, 10:37 GMT
Task Type Bugs
Category LCD
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Default codepage is set to UTF-8.

The usagi.mp3 is copied onto your player, and the database creates or updates.

After restart Rockbox. you operate Database > Track.
Then Rockbox abort.
(If you use ARM CPU's player, Rockbox outputs "XXXXX Divide by zero".)

The cause of this bug is as follows.

usagi.mp3: title 0x82a4 0x82b3 0x82ac (codepage: SJIS In Japanese "うさぎ")

Because the default codepage is UTF-8, Rockbox tries the output of "0x82a482b382ac".

When each byte of the title is included 0x80 - 0xbf like the example above, this bug happens.
(Similarly Artist, Album have the possibility to be happened.)

For the function lcd_puts_style_offset() (in firmware/drivers/lcd-*.c),
utf8length() executes.

Then, because of utf8length("0x82a482b382ac") == 0,
the following processing abort

xpos = x*w / utf8length((char *)str);

I think that correspondence is necessary because Rockbox aborts though it is the bug that occurs by a wrong operation.

This bug may happen following codepages.
- CP1251
- iso8859-11
- CP1256
- iso8859-2
- CP1250
- GB2312
- KSX1001
- BIG5

I send this bug's patch.
This task depends upon

Closed by  Yoshihisa Uchida (Uchida)
Friday, 28 May 2010, 10:37 GMT
Reason for closing:  Fixed
Additional comments about closing:  this bug fixed
Comment by Yoshihisa Uchida (Uchida) - Friday, 28 May 2010, 10:37 GMT
In the latest version (r26351), I confirmed that this problem did not occur.