openbullet / OpenBullet2

OpenBullet reinvented
https://docs.openbullet.dev/
MIT License
1.78k stars 479 forks source link

[Bug]: UnixTimeToDate Int32 overflow #623

Open holigo1 opened 2 years ago

holigo1 commented 2 years ago

Version of the software

0.2.0

Operating system

Windows 10

Browser / Native

Chrome 97

What happened?

Conversion of unix time will raise an Int32 Overflow Exception for too high value .

in OpenBullet2/RuriLib/Functions/Time/TimeConverter.cs UnixTimeToDate(... int unixTime ...) should use long

int32 max value is 2147483647 == "Tuesday 19 January 2038 03:14:07" Converting value past this day is impossible.

Stacker, loli and C# are impacted

Relevant LoliCode if needed

BLOCK:ConstantString
  value = "4294692759"
  => VAR @constantStringOutput
ENDBLOCK

BLOCK:UnixTimeToDate
  unixTime = @constantStringOutput
  => VAR @unixTimeToDateOutput
ENDBLOCK
openbullet commented 2 years ago

Hey, as I replied here https://github.com/openbullet/OpenBullet2/issues/255 I plan to implement the long type among the supported types of OB2 sooner or later, so don't worry, it will definitely be fixed before 2038 😅

holigo1 commented 2 years ago

Ok, no stress. I just deactivate the conversion for the time being where I have far far away date.😂 I saw it was not a so straight forward correction. So I preferred to report a bug instead of an ugly PR.

openbullet commented 2 years ago

👍 nice! Although, do you really think you will still be using OB2 in 16 years? 🤣