Chaosforge Forum

  • April 27, 2024, 18:07
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: [0.9.9.3] Display goes crazy on wearing Bulk Gothic Armor  (Read 2377 times)

Omegthemad

  • Lance Corporal
  • *
  • Offline Offline
  • Posts: 25
  • Lost Soul
    • View Profile

Stuck a bulk mod on an Ao100 run, thinking "surely they'll have blocked 300% armour, it sounds broken". Instead, it worked properly, the max armour durability went to 300%. Simultaneously, the text showing what armour I was wearing, and the background to that text only, started randomly changing colours.

The bug seems to stop when the armour is worn down a certain amount (221% at present, I didn't record the value at which it stopped). Not convinced screenshots would add much, it's reasonably replicable (or should be...)
Logged

thelaptop

  • Chaos Fanatic!
  • Grand Inquisitor
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 2530
    • View Profile
Re: [0.9.9.3] Display goes crazy on wearing Bulk Gothic Armor
« Reply #1 on: May 12, 2011, 02:25 »

My educated guess is that this is related to a buffer overflow bug.

Kornel, you seriously need a default case in your switch statements to catch anything that falls off the cracks...

(Insert appropriate language structure that is equivalent to the C/C++ switch statement for FreePascal.)
Logged
I computed, therefore I was.

ParaSait

  • Baffen :P
  • Elder
  • Lieutenant General
  • *
  • *
  • Offline Offline
  • Posts: 1229
  • Happy Little Boozer
    • View Profile
    • MPSF
Re: [0.9.9.3] Display goes crazy on wearing Bulk Gothic Armor
« Reply #2 on: May 12, 2011, 04:36 »

Kinda like pacman level 256. :P
Logged
[18|7|3|0|0|0] [MED:13/43] [SPE:36/67] [ASM:11/40]

Check out my epic youtube channel!
Currently playing The Bard's Tale and System Shock 2 (coop with GrAV1t)!

Deathwind

  • Colonel
  • *
  • Offline Offline
  • Posts: 505
  • HMP Angel of Patience 0.9.9.4
    • View Profile
Re: [0.9.9.3] Display goes crazy on wearing Bulk Gothic Armor
« Reply #3 on: May 13, 2011, 19:06 »

Time for a binary lesson,
Spoiler (click to show/hide)

Armor durability (and ammo for weapons) is stored in a one byte space of memory. A byte is 8 bits, as such one byte can only hold a max value of 255. When a larger value is stored in such a space the leading portion of the data will overwrite another section of memory. This behavior is called a buffer overflow and will generally cause a program to crash, but if it overwrites something noncritical (ie color data) the program will continue running with the altered data. Intentionally causing this to alter a running program is one of the most basic forms of hacking.

In your case the armor durability data was overwriting the code for the color of the text. The easy way to correct this bug store the durability for the gothic equipment in a 2 byte buffer but I'm not sure if that would work with the way the game is coded, otherwise you could make it cap at 255 or block bulk mods.
Logged
v.997 [16/5/2/0/0]
Pages: [1]