comparison mjpeg.c @ 779:915524c08334 libavcodec

3rd 10l - don't let it read data beyond the end of frame
author arpi_esp
date Sun, 27 Oct 2002 19:20:02 +0000
parents 6f24d6388750
children a48bb8bc63dd
comparison
equal deleted inserted replaced
778:6f24d6388750 779:915524c08334
1281 UINT8 *src = buf_ptr; 1281 UINT8 *src = buf_ptr;
1282 UINT8 *dst = s->buffer; 1282 UINT8 *dst = s->buffer;
1283 1283
1284 while (src<buf_end) 1284 while (src<buf_end)
1285 { 1285 {
1286 unsigned char x = *(src++); 1286 UINT8 x = *(src++);
1287 1287
1288 *(dst++) = x; 1288 *(dst++) = x;
1289 if (x == 0xff) 1289 if (x == 0xff)
1290 { 1290 {
1291 x = *(src++); 1291 x = *(src++);
1293 *(dst++) = x; 1293 *(dst++) = x;
1294 else if (x) 1294 else if (x)
1295 break; 1295 break;
1296 } 1296 }
1297 } 1297 }
1298 init_get_bits(&s->gb, s->buffer, s->buffer_size); 1298 init_get_bits(&s->gb, s->buffer, dst - s->buffer);
1299 } 1299 }
1300 else 1300 else
1301 init_get_bits(&s->gb, buf_ptr, buf_end - buf_ptr); 1301 init_get_bits(&s->gb, buf_ptr, buf_end - buf_ptr);
1302 1302
1303 s->start_code = start_code; 1303 s->start_code = start_code;