mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/mss12: Don't apply non-zero offset to null pointer
Affected the FATE tests mss2-wmv and mss1-pal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
dd9cbd1cc3
commit
8429661db8
@ -291,14 +291,15 @@ static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx,
|
||||
return decode_pixel(acoder, pctx, ref_pix, nlen, 1);
|
||||
}
|
||||
|
||||
static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic,
|
||||
static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_dst,
|
||||
int x, int y, int width, int height, ptrdiff_t stride,
|
||||
ptrdiff_t rgb_stride, PixContext *pctx,
|
||||
const uint32_t *pal)
|
||||
{
|
||||
int i, j, p;
|
||||
uint8_t *rgb_dst = rgb_pic + x * 3 + y * rgb_stride;
|
||||
|
||||
rgb_stride = rgb_dst ? rgb_stride : 0;
|
||||
rgb_dst = rgb_dst ? rgb_dst + x * 3 + y * rgb_stride : NULL;
|
||||
dst += x + y * stride;
|
||||
|
||||
for (j = 0; j < height; j++) {
|
||||
@ -312,11 +313,11 @@ static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic,
|
||||
return p;
|
||||
dst[i] = p;
|
||||
|
||||
if (rgb_pic)
|
||||
if (rgb_dst)
|
||||
AV_WB24(rgb_dst + i * 3, pal[p]);
|
||||
}
|
||||
dst += stride;
|
||||
rgb_dst += rgb_stride;
|
||||
rgb_dst = FF_PTR_ADD(rgb_dst, rgb_stride);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -476,17 +477,19 @@ static int decode_region_intra(SliceContext *sc, ArithCoder *acoder,
|
||||
ptrdiff_t stride = c->pal_stride;
|
||||
ptrdiff_t rgb_stride = c->rgb_stride;
|
||||
uint8_t *dst = c->pal_pic + x + y * stride;
|
||||
uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * rgb_stride;
|
||||
uint8_t *rgb_dst = c->rgb_pic ? c->rgb_pic + x * 3 + y * rgb_stride : NULL;
|
||||
|
||||
pix = decode_pixel(acoder, &sc->intra_pix_ctx, NULL, 0, 0);
|
||||
if (pix < 0)
|
||||
return pix;
|
||||
rgb_pix = c->pal[pix];
|
||||
for (i = 0; i < height; i++, dst += stride, rgb_dst += rgb_stride) {
|
||||
for (i = 0; i < height; i++, dst += stride) {
|
||||
memset(dst, pix, width);
|
||||
if (c->rgb_pic)
|
||||
if (rgb_dst) {
|
||||
for (j = 0; j < width * 3; j += 3)
|
||||
AV_WB24(rgb_dst + j, rgb_pix);
|
||||
rgb_dst += rgb_stride;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return decode_region(acoder, c->pal_pic, c->rgb_pic,
|
||||
|
Loading…
x
Reference in New Issue
Block a user