while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (num_pixels * (s->buf[stream_ptr++] - 1));
+ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (4 * (s->buf[stream_ptr++] - 1));
+ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 2;
+ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 3;
+ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
int rle_code;
int pixel_ptr;
int row_inc = s->frame.linesize[0];
- unsigned char a, r, g, b;
unsigned int argb;
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
CHECK_STREAM_PTR(2);
pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
+ CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
if (rle_code == 0) {
/* decode the run length code */
rle_code = -rle_code;
CHECK_STREAM_PTR(4);
- a = s->buf[stream_ptr++];
- r = s->buf[stream_ptr++];
- g = s->buf[stream_ptr++];
- b = s->buf[stream_ptr++];
- argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
+ argb = AV_RB32(s->buf + stream_ptr);
+ stream_ptr += 4;
CHECK_PIXEL_PTR(rle_code * 4);
while (rle_code--) {
- *(unsigned int *)(&rgb[pixel_ptr]) = argb;
+ AV_WN32A(rgb + pixel_ptr, argb);
pixel_ptr += 4;
}
} else {
/* copy pixels directly to output */
while (rle_code--) {
- a = s->buf[stream_ptr++];
- r = s->buf[stream_ptr++];
- g = s->buf[stream_ptr++];
- b = s->buf[stream_ptr++];
- argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
- *(unsigned int *)(&rgb[pixel_ptr]) = argb;
- pixel_ptr += 4;
+ argb = AV_RB32(s->buf + stream_ptr);
+ AV_WN32A(rgb + pixel_ptr, argb);
+ stream_ptr += 4;
+ pixel_ptr += 4;
}
}
}
s->buf = buf;
s->size = buf_size;
- s->frame.reference = 1;
+ s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
if (avctx->reget_buffer(avctx, &s->frame)) {
stream_ptr += 4;
height = AV_RB16(&s->buf[stream_ptr]);
stream_ptr += 4;
+ if (height > s->avctx->height - start_line)
+ goto done;
} else {
start_line = 0;
height = s->avctx->height;