[FFmpeg-trac] #7435(undetermined:new): Possible access to unintended variable in "libavcodec/bitstream.c" line 227

FFmpeg trac at avcodec.org
Wed Sep 12 15:38:54 EEST 2018

#7435: Possible access to unintended variable in "libavcodec/bitstream.c" line 227
             Reporter:  petrum       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 While experimenting with a CodeSonar plugin we develop, we noticed a
 potential bug in file "libavcodec/bitstream.c" line 227, function

 index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
 if (index < 0)
     return index;
 /* note: realloc has been done, so reload tables */
 table = (volatile VLC_TYPE (*)[2])&vlc->table[table_index]; // HERE
 table[j][0] = index; //code

 Shouldn't index be used instead of table_index? We are not too sure about
 this especially due to the following line (also using table and index) but
 we said to report it at least for a better code understanding.

 Petru Florin Mihancea

Ticket URL: <https://trac.ffmpeg.org/ticket/7435>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list