Skip to content

Commit

Permalink
fix undefined behaviour in stb_vorbis.c Fixes distorted decompressed …
Browse files Browse the repository at this point in the history
…audio when UBSan was enabled.

nothings#1563
  • Loading branch information
Seb-degraff authored and sezero committed Dec 12, 2023
1 parent 7b59897 commit b025ad7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stb_vorbis.c
Original file line number Diff line number Diff line change
Expand Up @@ -2095,15 +2095,15 @@ static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y
ady -= abs(base) * adx;
if (x1 > n) x1 = n;
if (x < x1) {
LINE_OP(output[x], inverse_db_table[y&255]);
LINE_OP(output[x], inverse_db_table[(uint32)y&255]);
for (++x; x < x1; ++x) {
err += ady;
if (err >= adx) {
err -= adx;
y += sy;
} else
y += base;
LINE_OP(output[x], inverse_db_table[y&255]);
LINE_OP(output[x], inverse_db_table[(uint32)y&255]);
}
}
}
Expand Down

0 comments on commit b025ad7

Please sign in to comment.