this post was submitted on 28 Mar 2025
82 points (98.8% liked)

Just Post

796 readers
87 users here now

Just post something ๐Ÿ’›

founded 1 year ago
MODERATORS
 
top 8 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 21 points 5 days ago (3 children)

16-bit integer overflow I would guess

[โ€“] [email protected] 11 points 5 days ago

I found 0xFFFF gold in a knapsack!

[โ€“] [email protected] 7 points 5 days ago* (last edited 5 days ago) (2 children)

Give that man a cigar.

2^16 is 65,536 precisely, one less than that is the number in question. 65,535 is the maximum value of an unsigned 16 bit integer, i.e. sixteen ones in binary: 1111111111111111.

Any nerd who has spent enough time around computers, or at least old computer games, will recognize that instantly as well as the maximum of an 8 bit integer (255) and 32 bit integer (4,294,967,295) because these are inevitably the values you see on your score/money/ammo/whatever counter when you bork your game. Deliberately or otherwise.

[โ€“] [email protected] 1 points 5 days ago

1/1/1970 for the epoch

[โ€“] [email protected] 1 points 5 days ago (1 children)

Fun fact: the maximum amount of money you can hold in Maple story is actually half the 32 bit maximum, at 2,147,483,647.

[โ€“] [email protected] 7 points 5 days ago (1 children)

That means it's being stored as a signed integer for some reason. The other half of the binary space is for the negative values, which was probably a poor choice. Unless there is a valid case when you can have negative money. Is debt a thing in Maple Story?

[โ€“] [email protected] 3 points 5 days ago

Not at all, but it definitely used to get exploited a lot back in the day.

I bet they thought using signed integers made math easier or something.

[โ€“] [email protected] 3 points 5 days ago

Yeah, off-by-one errors are the most common error in programming, and when you are off by +1, and then try to bring it down to 0, it rolls over to max value instead. It makes sense, since some things use 0 as 1 and some things use 1 as 1. The programmer usually just has to memorize which is which... so yeah. Not surprising that it is the most common cause of bugs.