Commit aec5446e authored by michael's avatar michael

64bit and reading over the end of the array fixes


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3547 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9b3e25ef
...@@ -1026,21 +1026,18 @@ static int mpeg_mux_end(AVFormatContext *ctx) ...@@ -1026,21 +1026,18 @@ static int mpeg_mux_end(AVFormatContext *ctx)
static int mpegps_probe(AVProbeData *p) static int mpegps_probe(AVProbeData *p)
{ {
int code, c, i; int i;
int size= FFMIN(20, p->buf_size);
uint32_t code=0xFF;
code = 0xff;
/* we search the first start code. If it is a packet start code, /* we search the first start code. If it is a packet start code,
then we decide it is mpeg ps. We do not send highest value to then we decide it is mpeg ps. We do not send highest value to
give a chance to mpegts */ give a chance to mpegts */
/* NOTE: the search range was restricted to avoid too many false /* NOTE: the search range was restricted to avoid too many false
detections */ detections */
if (p->buf_size < 6) for (i = 0; i < size; i++) {
return 0; code = (code << 8) | p->buf[i];
for (i = 0; i < 20; i++) {
c = p->buf[i];
code = (code << 8) | c;
if ((code & 0xffffff00) == 0x100) { if ((code & 0xffffff00) == 0x100) {
if (code == PACK_START_CODE || if (code == PACK_START_CODE ||
code == SYSTEM_HEADER_START_CODE || code == SYSTEM_HEADER_START_CODE ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment