#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)
Change History (6)
by , 14 months ago
Attachment: | date-9346-debug-25-09-2023-09-18-50.report added |
---|
comment:1 by , 14 months ago
Component: | - General → System/libroot.so |
---|
comment:2 by , 13 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 , 13 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev57356.
comment:4 by , 13 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 , 13 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.
/bin/date crash