mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-27 21:40:34 +00:00
avcodec/targa: Skip hflip on blank images
Fixes: timeout with 810/clusterfuzz-testcase-5249282825256960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
1467143a6e
commit
acdacb108d
@ -265,32 +265,33 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
line = advance_line(dst, line, stride, &y, h, interleave);
|
line = advance_line(dst, line, stride, &y, h, interleave);
|
||||||
} while (line);
|
} while (line);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
|
if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
|
||||||
int x;
|
int x;
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
void *line = &p->data[0][y * p->linesize[0]];
|
void *line = &p->data[0][y * p->linesize[0]];
|
||||||
for (x = 0; x < w >> 1; x++) {
|
for (x = 0; x < w >> 1; x++) {
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 32:
|
case 32:
|
||||||
FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
|
FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * w - 3 * x - 3]);
|
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * w - 3 * x - 3]);
|
||||||
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * w - 3 * x - 2]);
|
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * w - 3 * x - 2]);
|
||||||
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * w - 3 * x - 1]);
|
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * w - 3 * x - 1]);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[w - x - 1]);
|
FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[w - x - 1]);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[w - x - 1]);
|
FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[w - x - 1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
|
||||||
return avpkt->size;
|
return avpkt->size;
|
||||||
|
Loading…
Reference in New Issue
Block a user