h = bytestream2_get_le16(&s->gb);
bpp = bytestream2_get_byte(&s->gb);
- if (bytestream2_get_bytes_left(&s->gb) <= idlen) {
- av_log(avctx, AV_LOG_ERROR,
- "Not enough data to read header\n");
- return AVERROR_INVALIDDATA;
- }
-
flags = bytestream2_get_byte(&s->gb);
if (!pal && (first_clr || colors || csize)) {
first_clr = colors = csize = 0;
}
+ if (bytestream2_get_bytes_left(&s->gb) < idlen + 2*colors) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Not enough data to read header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
// skip identifier if any
bytestream2_skip(&s->gb, idlen);
return avpkt->size;
}
-AVCodec ff_targa_decoder = {
+const AVCodec ff_targa_decoder = {
.name = "targa",
.long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
.type = AVMEDIA_TYPE_VIDEO,