prestodb/presto

Presto allows parsing of invalid timezone names

Open

#21,461 opened on Nov 30, 2023

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (5,240 forks)batch import
buggood first issue

Repository metrics

Stars
 (15,558 stars)
PR merge metrics
 (Avg merge 34d 14h) (120 merged PRs in 30d)

Description

Presto's timezone parsing is too permissive and allows for timezone names that are not valid according to IANA's timezone database, in addition to other bugs:

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

The following are examples of non-compliant timezone names that are allowed:

ETC/+06:00
ETC/+06
ETC/+6
ETC/UTC*
ETC/UT*

-> the only official formats are "ETC/GMT+1" and similar

EST

-> not supported, but it should be

timezones in the format:

ETC/GMT+10:00

besides not being official, return the wrong result (don't flip the sign as they should)

+1
+01

officially also don't exist (only "+01:00")

Expected Behavior

These should fail to parse, though it might break backwards compatibility.

Current Behavior

They are parsed successfully (incorrectly).

Steps to Reproduce

presto> select from_unixtime(1698528090, 'ETC/+06:00');
             _col0              
--------------------------------
 2023-10-29 03:21:30.000 +06:00 

and other variations described above.

Cc: @mbasmanova @zacw7

Contributor guide