View Single Post
02/17/19, 09:25 AM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,568
[open] os.date crash

The game crashes when I call os.date with a timestamp that is bigger than the highest signed 32-bit integer (year 2038 problem) and also for timestamps that correspond to 0 or a negative number in UTC.
Lua Code:
  1. os.date("%F %H:%M", 2147483647) -- works
  2. os.date("%F %H:%M", 2147483648) -- crashes
  3. os.date("%F %H:%M", -3599) -- works in UTC+1
  4. os.date("%F %H:%M", -3600) -- crashes in UTC+1
Not a huge issue since usually one shouldn't have those numbers as input for the method, but would be nice if the game could at least ignore those values or show an error instead of just closing itself. Took me a few hours to figure it out, since we still don't get a stack trace when the game crashes due to an addon and I didn't know which of my changes caused the crash.
  Reply With Quote