History

avcodec/h261enc: Don't use (size_t)-1

Fixes "runtime error: addition of unsigned offset to 0x765a09523a90 overflowed to 0x765a09523a8e". This fixes all H.261 tests when run under UBsan.

Andreas Rheinhardt committed 1 year ago

Commit fbcc9431 parent 950ad961 file · +1 −1Browse files

Unified · Split

libavcodec/h261enc.c+1−1
@@ -337,7 +337,7 @@ static av_cold void h261_encode_init_static(void) · 336 unmodified lines
337337 uni_h261_rl_len_last[UNI_AC_ENC_INDEX(run, 64 - level)] = len + 2;
338338 }
339339
340− for (size_t i = 1;; i++) {
340+ for (ptrdiff_t i = 1;; i++) {
341341 // sign-one MV codes; diff -16..-1, 16..31
342342 mv_codes[32 - i][0] = mv_codes[-i][0] = (ff_h261_mv_tab[i][0] << 1) | 1 /* sign */;
343343 mv_codes[32 - i][1] = mv_codes[-i][1] = ff_h261_mv_tab[i][1] + 1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t