prestodb/presto

Presto allows parsing of invalid timezone names

Aperta

#21.461 aperta il 30 nov 2023

 (5 commenti) (0 reazioni) (0 assegnatari)Java (5240 fork)batch import
buggood first issue

Metriche repository

Star
 (15.558 stelle)
Metriche merge PR
 (Merge medio 34g 14h) (120 PR mergiate in 30 g)

Descrizione

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

Guida contributor