mxfdec: Fix CID 732262

Coverity thinks ofs can end up 15, thus writing past the end of layout[]. This
is incorrect since it's always incremented by 2. Checking ofs <= 14 makes
Coverity happy and doesn't hurt.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/6/merge
Tomas Härdin 12 years ago committed by Michael Niedermayer
parent 55c77a0ca3
commit 187630b244
  1. 4
      libavformat/mxfdec.c

@ -782,14 +782,14 @@ static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int
static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor)
{
int code, value, ofs = 0;
char layout[16] = {0};
char layout[16] = {0}; /* not for printing, may end up not terminated on purpose */
do {
code = avio_r8(pb);
value = avio_r8(pb);
av_dlog(NULL, "pixel layout: code %#x\n", code);
if (ofs < 16) {
if (ofs <= 14) {
layout[ofs++] = code;
layout[ofs++] = value;
}

Loading…
Cancel
Save