Opened 8 months ago

Closed 7 months ago

Last modified 7 months ago

#18598 closed bug (fixed)

/bin/date crashes for certain values of the TZ env-var.

Reported by: bipolar Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: System/libroot.so Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Found this while working on updating the 'timezone_data' package.

The following works from Terminal:

> LANG=C TZ="/system/data/zoneinfo/America/Argentina/Buenos_Aires" date

but what tzselect tries to do (as it uses haikuporter's "$dataDir" as root to find the zoneinfo data) is:

> LANG=C TZ="/packages/timezone_data-2023c-1/.self/data/zoneinfo/America/Argentina/Buenos_Aires" date

and that causes /bin/date to crash (will attach debug .report)

Note that

> LANG=C TZ="/packages/timezone_data-2023c-1/.self/data/zoneinfo/America" date

does NOT causes /bin/date to crash.

Attachments (1)

date-9346-debug-25-09-2023-09-18-50.report (13.2 KB ) - added by bipolar 8 months ago.
/bin/date crash

Download all attachments as: .zip

Change History (6)

by bipolar, 8 months ago

/bin/date crash

comment:1 by waddlesplash, 8 months ago

Component: - GeneralSystem/libroot.so

comment:2 by waddlesplash, 7 months ago

This looks like some sort of stack overflow. The data in rcx appears to be ASCII but it's being used as a pointer.

Inspecting the code, it looks like a wrong length is used for the CheckedArrayByteSink parameter. But fixing that doesn't seem to fix the crash...

comment:3 by waddlesplash, 7 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev57356.

comment:4 by jessicah, 7 months ago

Wouldn't a better fix be to use heap allocated strings? This isn't really a suitable fix, as now programs that use package relative timezone paths will fail.

comment:5 by waddlesplash, 7 months ago

The data stored in these strings should only ever be the timezone *name*, not a path to a timezone description file. ICU should parse the passed information and come up with a suitable name; if it doesn't, then that means it failed to parse properly and we'll wind up with GMT anyway. The length thus shouldn't need to be as long as the paths are.

Note: See TracTickets for help on using tickets.