Opened 10 years ago

Closed 10 years ago

#6661 closed defect (fixed)

NEVERHOOD: Uninitialized variable during car ride

Reported by: eriktorbjorn Owned by: johndoe123
Priority: normal Component: Engine: Neverhood
Version: Keywords:
Cc: Game: The Neverhood

Description

If I use the attached savegame and ride the car up into the next room, I get the following Valgrind warnings:

==9466== Conditional jump or move depends on uninitialised value(s)
==9466==    at 0x4671167: sqrt (w_sqrt.c:27)
==9466==    by 0x8B091A0: Neverhood::calcDistance(short, short, short, short) (graphics.cpp:355)
==9466==    by 0x8AB59FC: Neverhood::AsCommonCar::suMoveToPrevPoint() (module1600_sprites.cpp:741)
==9466==    by 0x8A870FD: Neverhood::Sprite::handleSpriteUpdate() (sprite.h:101)
==9466==    by 0x8B04FAD: Neverhood::AnimatedSprite::update() (sprite.cpp:224)
==9466==    by 0x8AB2BE0: Neverhood::AsCommonCar::update() (module1600_sprites.cpp:75)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8B0037D: Neverhood::Scene::update() (scene.cpp:276)
==9466==    by 0x8AD592F: Neverhood::Scene2501::upRidingCar() (module2500.cpp:378)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466==    by 0x8AD47AF: Neverhood::Module2500::updateScene() (module2500.cpp:145)
==9466== 
==9466== Conditional jump or move depends on uninitialised value(s)
==9466==    at 0x8AB5B69: Neverhood::AsCommonCar::suMoveToPrevPoint() (module1600_sprites.cpp:764)
==9466==    by 0x8A870FD: Neverhood::Sprite::handleSpriteUpdate() (sprite.h:101)
==9466==    by 0x8B04FAD: Neverhood::AnimatedSprite::update() (sprite.cpp:224)
==9466==    by 0x8AB2BE0: Neverhood::AsCommonCar::update() (module1600_sprites.cpp:75)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8B0037D: Neverhood::Scene::update() (scene.cpp:276)
==9466==    by 0x8AD592F: Neverhood::Scene2501::upRidingCar() (module2500.cpp:378)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466==    by 0x8AD47AF: Neverhood::Module2500::updateScene() (module2500.cpp:145)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466== 
==9466== Conditional jump or move depends on uninitialised value(s)
==9466==    at 0x8AB5BA2: Neverhood::AsCommonCar::suMoveToPrevPoint() (module1600_sprites.cpp:765)
==9466==    by 0x8A870FD: Neverhood::Sprite::handleSpriteUpdate() (sprite.h:101)
==9466==    by 0x8B04FAD: Neverhood::AnimatedSprite::update() (sprite.cpp:224)
==9466==    by 0x8AB2BE0: Neverhood::AsCommonCar::update() (module1600_sprites.cpp:75)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8B0037D: Neverhood::Scene::update() (scene.cpp:276)
==9466==    by 0x8AD592F: Neverhood::Scene2501::upRidingCar() (module2500.cpp:378)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466==    by 0x8AD47AF: Neverhood::Module2500::updateScene() (module2500.cpp:145)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466== 
==9466== Conditional jump or move depends on uninitialised value(s)
==9466==    at 0x8AB5BBA: Neverhood::AsCommonCar::suMoveToPrevPoint() (module1600_sprites.cpp:767)
==9466==    by 0x8A870FD: Neverhood::Sprite::handleSpriteUpdate() (sprite.h:101)
==9466==    by 0x8B04FAD: Neverhood::AnimatedSprite::update() (sprite.cpp:224)
==9466==    by 0x8AB2BE0: Neverhood::AsCommonCar::update() (module1600_sprites.cpp:75)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8B0037D: Neverhood::Scene::update() (scene.cpp:276)
==9466==    by 0x8AD592F: Neverhood::Scene2501::upRidingCar() (module2500.cpp:378)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466==    by 0x8AD47AF: Neverhood::Module2500::updateScene() (module2500.cpp:145)
==9466==    by 0x8A7EDCE: Neverhood::Entity::handleUpdate() (entity.cpp:64)
==9466==    by 0x8A88EF0: Neverhood::Module::updateChild() (module.cpp:104)
==9466== 

I couldn't figure out how to fix it, but it looks to me as if _destX and _destY are the uninitialized variables. The same thing happened when I entered the same room from the right.

Ticket imported from: bugs/6661.

Attachments (1)

neverhood-win.006 (23.4 KB ) - added by eriktorbjorn 10 years ago.

Download all attachments as: .zip

Change History (6)

by eriktorbjorn, 10 years ago

Attachment: neverhood-win.006 added

comment:1 by digitall, 10 years ago

eriktorbjorn: I assume that 95ba430d11a09ec6fbc997550074b940223eebf5 was not the root cause of this and you are still debugging?

comment:2 by digitall, 10 years ago

Owner: set to johndoe123

comment:3 by eriktorbjorn, 10 years ago

You're half right. That commit was to fix a different Valgrind warning, but I gave up on debugging this one and went back to trying other parts in Valgrind. (No other warnings so far.)

comment:4 by digitall, 10 years ago

Replicated. This was as you indicated _destX and _destY not being initialized in the constructor. Commit a1b80bb536801568ed43089cf3cc284383283bc4 fixes this by setting them with the current x, y passed in. Check with valgrind and this fixes the problem. Closing as fixed.

comment:5 by digitall, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.