Skip to content
Snippets Groups Projects
Forked from Xiph.Org / theora
Loading
user avatar
Petter Reinholdtsen authored
Check if argument is null before using this approach, and just return
zero when the value to do bit count on is zero.

Fixes a issue discovered by --enable-gcc-sanitizers in !31:

  ../../lib/encode.c:1384:49: runtime error: passing zero to clz(),
    which is not a valid argument
    #0 0x7f0af5dae97d in th_encode_ctl ../../lib/encode.c:1384
    #1 0x7f0af5e2eb97 in theora_encode_init ../../lib/encapiwrapper.c:72
    #2 0x55fd4beb18b7 in granulepos_test_encode
     ../../tests/granulepos_theora.c:71
    #3 0x55fd4beb126d in main ../../tests/granulepos_theora.c:137
    #4 0x7f0af51d3249 in __libc_start_call_main
     ../sysdeps/nptl/libc_start_call_main.h:58
    #5 0x7f0af51d3304 in __libc_start_main_impl ../csu/libc-start.c:360
    #6 0x55fd4beb1300 in _start
     (/home/user/libtheora/build/tests/.libs/granulepos_theoraenc+0x2300)

Fixes #2323
0cb634ec
History
Name Last commit Last update