An assignment due in 2046 crashed the app
An assessment due in July 2046 crashed the Grades screen of the Monash Study App, and a second screen showed the same date as 1910 without a word. The app won't let you enter a date that far ahead, so I had to prove the crash some other way.
By Ojas KekreCyber security, Monash University
One assessment in the Monash Study App was due at 11:55 pm on 21 July 2046. The payload carried that as 2,415,794,100 seconds since 1970, and the Grades screen crashed trying to read it.
The ticket for the crash already had a diagnosis, a decimal where the parser wanted a whole number, and a fix to match. The payload held a whole number, 268,310,453 seconds more than a signed 32-bit Int can hold.
- When the assessment was due
- 2046
- Where a signed 32-bit Int runs out
- 2038
- What a second screen showed instead
- 1910
The 32-bit limit
- 1Any date in 20301,893,456,000 secondsFits, so it can't show the bug
- 219 Jan 20382,147,483,647 seconds2,147,483,647, the last second an Int holds
- 321 Jul 20462,415,794,100 seconds2,415,794,100, the due date
- Fits in an Int1,577,836,800 seconds to 2,147,483,647 seconds
- Too big for an Int2,147,483,648 seconds to 2,524,608,000 seconds
What each screen did with it
| Grades | Timetable | |
|---|---|---|
| How it read the number | As an Int field | Through a helper that called toInt() |
| What happened | Gson refused it, and the whole response failed | toInt() kept the low 32 bits and threw nothing |
| What a student saw | A crash | A date in 1910 |
| Reported | Yes, it had a ticket | No error and no report |
1val seconds = 2_415_794_100L // 21 Jul 2046, 11:55 pm in Melbourne
2val narrowed = seconds.toInt() // -1_879_173_196
3// as a date: 15 Jun 1910- 1L2Keeps the low 32 bits, which is 2,415,794,100 minus 2^32. No exception.
I widened the Grades field to Long and split the helper into a Long one for timestamps and an Int one for small counts. That part is in my placement post. The harder part was getting anyone else to see the crash.
A crash nobody could cause
The reviewer couldn't reproduce it in dev, and wanted exact steps before approving, proof the crash existed and then proof the change ended it. I couldn't reproduce it through the app either. It won't let you set a date that far ahead.
I had seeded my own data with a date past 2038 instead, so the reply was a write-up.
| Part | What it said |
|---|---|
| The field | The assessment's due date, in seconds since 1970 |
| The value | 2,415,794,100, or 21 July 2046 |
| Why 2027 or 2030 won't show it | Both fit in an Int. Nothing before 19 January 2038 overflows |
| The proof | A unit test at the 32-bit edge, already pushed |
The reviewer tested it and approved it the same afternoon.