Integer wrap-rounds
issueid=25 03-11-2008 04:15 AM
Ancient Member
Number of reported issues by Grey: 54
Integer wrap-rounds
Several bugs can crop up during play due integer wrap-rounds

A number of different variables in the game do not have any protection from wrap-rounds, meaning that making the value too low will cause it to flip over to a very high amount, or increasing the value too much can result in a very low value. This has the potential to affect game balance heavily, possibly even fatally.

Known examples:

-Piety wrap-round. Continuously praying will reduce piety more and more, until it wraps round to an extremely high value, allowing for easy precrownings. (Though some method of dealing with the deity summons is needed to abuse this it is still very exploitable.)
-Gold wrap-round. Increasing a stack of gold beyond 2 billion will make it become negative gold, which behaves buggily and can crash the game. (this level of gold can be reached with dragon gold-doubling, potentially another bug in itself)
-Moloch armour bug. A monster with low dexterity that equips moloch armour will have it's dexterity wrap round to a high amount resulting in it being insanely fast. This becomes a game-ending issue when a threat room of greater molochs is encountered - a super-fast greater moloch will kill most characters rather quickly.

These are the only 3 known to affect gameplay, but other such bugs may exist undiscovered or unexploitable. I've grouped them in the one report as they have a common cause and solution.
Issue Details
Issue Number 25
Project ADOM (Ancient Domains Of Mystery)
Category Unknown
Status Fixed
Priority 5 - Medium
Affected Version ADOM 1.1.1
Fixed Version ADOM 1.2.0 pre 1
Milestone (none)
Users able to reproduce bug 5
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)




03-11-2008 08:05 AM
Ancient Member
And molochs wearing moloch armour over another suit of moloch armour is propably a bug by itself.

04-23-2008 03:05 PM
Ancient Member
I think it was discovered that with molochs, it's not actually a Dexterity wrap around, but the fact that they get a ludicrous one-time amount of energy points, enabling them to act once for every segment until that stock is depleted...

04-28-2010 11:07 PM
Senior Member
According to sorear, "When a monster puts on a moloch armor, the energy cost of doing so - should be 37600 - wraps around to -27936, giving them 28 free turns. "

02-02-2012 09:12 PM
Ancient Member
There's also overflow experience from what I've read: very high xp gains from monsters wrapping to 1xp.

02-06-2012 07:34 PM
jt jt is online now
Administrator
The bit-size for a large number of variables was doubled, including items (gold), experience, piety and energy points.

02-06-2012 11:33 PM
Ancient Member
In other words, you can still perform piety overflow, but now your character will die of old age before you're done? :)

02-07-2012 02:38 PM
Ancient Member
While this certainly solves the moloch armor problem, the experience problem and probably the piety problem too, it will not prevent you from reaching negative gold with dragon gold doubling. Exponential growth is exponential.

02-07-2012 03:41 PM
Ancient Member
Quote Originally Posted by grobblewobble
While this certainly solves the moloch armor problem, the experience problem and probably the piety problem too, it will not prevent you from reaching negative gold with dragon gold doubling. Exponential growth is exponential.
Well, the obvious solution would be to fix dragon doubling.

02-07-2012 11:24 PM
Ancient Member
Quote Originally Posted by grobblewobble
While this certainly solves the moloch armor problem
Wasn't the moloch armor problem due to Dx going into the negatives? That may remain too, increasing the upper range of the variable won't help with Dx going <0.

02-08-2012 01:52 AM
Ancient Member
Quote Originally Posted by Al-Khwarizmi
Wasn't the moloch armor problem due to Dx going into the negatives? That may remain too, increasing the upper range of the variable won't help with Dx going <0.
See sorear's quote above. It's an energy cost integer wraparound, apparently.

02-08-2012 01:45 PM
Ancient Member
Oh, OK. Sorry for the noise :/

02-08-2012 05:39 PM
Ancient Member
Moloch armor does reduce Dexterity, but that's for the PC. Monsters, as far as I know, do not have attribute scores, but rather a set of "raw" properties such as DV, PV, level, damage, etc. (revealed by the blessed stethoscope).

Another integer overflow that hasn't been mentioned here is associated to the "he/she got the traders' guild to owe him/her money" achievement. According some HoF logs, the reward for it is so big, it can easily drop the score into the negatives.

02-09-2012 06:43 PM
jt jt is online now
Administrator
Quote Originally Posted by JellySlayer
Well, the obvious solution would be to fix dragon doubling.
It's fixed now, see http://www.adom.de/forums/project.php?issueid=111.

04-09-2012 02:38 PM
Ancient Member
Quote Originally Posted by anon123
Another integer overflow that hasn't been mentioned here is associated to the "he/she got the traders' guild to owe him/her money" achievement. According some HoF logs, the reward for it is so big, it can easily drop the score into the negatives.
In addition:

* If the PC drinks ~32780 cursed potions of quickling blood while their speed is 10, it will wrap around and jump to 32768. If at this point the PC increases their speed even by just 1 point, it jumps to 10 again.

* "(i)t has been proved possible for Satiation to overflow from Bloated to Starved by reading approximately 1.07 million blessed scrolls of satiation - 2.1 billion points of satiation. At this point, the player will die." -- ADOM Wiki. Assumedly, potions of (potential) toughness would also cause this.

* If the PC eats a lot of cursed stomacemptia herbs (from 20 to 30, dependant on To), he will go from Starving! to Starved without dying. He then becomes a "zombie" that can walk around without needing food, and with St, Le, Wi and Dx halved - somehow, having the nutrition level dip below -(To*8)+2 didn't kill him. This is very abusable. (I'm not entirely sure this qualifies as an overflow, please let me know if I should post it separately.)

The first two are extremely unlikely scenarios, but possible with an archmage, patience, a macro program, and a strong desire to see the game break (you could just drink 32780 blessed potions...), so I thought I'd post.

04-27-2012 02:13 AM
Ancient Member
I was also thinking that (unless it's also been fixed), the integer for carrying capacity must be taken care of, or else it'd be possible to make it overflow, if carrying more than 2.1 billion gp is possible.

05-02-2012 07:32 PM
jt jt is online now
Administrator
There are probably many more places/situations where you can create an integer under-/overflow. Preventing all these situations would mean some really major changes to the ADOM sources. I think the changes that were already made should prevent under-/overflow in a "normal" game.

Additions:

a) the range of the speed variable has been increased
b) won't be fixed (see above)
c) this was no overflow problem, but it's fixed now
d) carrying capacity was already fixed

+ Reply