diff options
-rw-r--r-- | gflib/sprite.c | 5 | ||||
-rw-r--r-- | src/pokedex.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gflib/sprite.c b/gflib/sprite.c index c7e3d09a3..2616aeaed 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -1320,6 +1320,11 @@ void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnim s16 ConvertScaleParam(s16 scale) { s32 val = 0x10000; + // UB: possible division by zero +#ifdef UBFIX + if (scale == 0) + return 0; +#endif //UBFIX return val / scale; } diff --git a/src/pokedex.c b/src/pokedex.c index 691abd649..6aa347994 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -3042,7 +3042,7 @@ static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite) if (gSineTable[sprite->data[5] + 64] != 0) var = 0x10000 / gSineTable[sprite->data[5] + 64]; else - var = 0xFFFF; + var = 0; #else var = 0x10000 / gSineTable[sprite->data[5] + 64]; #endif //UBFIX |