Browse Source

mlp_parser: Fix infinite loop with 0 bytes_left.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.10
Michael Niedermayer 14 years ago
parent
commit
e146ad95d7
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      libavcodec/mlp_parser.c

+ 3
- 0
libavcodec/mlp_parser.c View File

@@ -263,6 +263,9 @@ static int mlp_parse(AVCodecParserContext *s,
mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8) mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8)
| (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]); | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]);
mp->bytes_left = (mp->bytes_left & 0xfff) * 2; mp->bytes_left = (mp->bytes_left & 0xfff) * 2;
if (mp->bytes_left <= 0) { // prevent infinite loop
goto lost_sync;
}
mp->bytes_left -= mp->pc.index; mp->bytes_left -= mp->pc.index;
} }




Loading…
Cancel
Save