lcl: don't overwrite input memory.
If the PNG filter is enabled, a PNG-style filter will run over the input buffer, writing into the buffer. Therefore, if no zlib compression was used, ensure that we copy into a temporary buffer, otherwise we overwrite user-provided input data.
This commit is contained in:
parent
1d8c4af396
commit
01cb62aba2
@ -236,9 +236,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
|||||||
* gives a file with ZLIB fourcc, but frame is really uncompressed.
|
* gives a file with ZLIB fourcc, but frame is really uncompressed.
|
||||||
* To be sure that's true check also frame size */
|
* To be sure that's true check also frame size */
|
||||||
if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
|
if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
|
||||||
len == width * height * 3)
|
len == width * height * 3) {
|
||||||
break;
|
if (c->flags & FLAG_PNGFILTER) {
|
||||||
if (c->flags & FLAG_MULTITHREAD) {
|
memcpy(c->decomp_buf, encoded, len);
|
||||||
|
encoded = c->decomp_buf;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (c->flags & FLAG_MULTITHREAD) {
|
||||||
int ret;
|
int ret;
|
||||||
mthread_inlen = AV_RL32(encoded);
|
mthread_inlen = AV_RL32(encoded);
|
||||||
mthread_inlen = FFMIN(mthread_inlen, len - 8);
|
mthread_inlen = FFMIN(mthread_inlen, len - 8);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user