return 0;
}
- av_assert0(size > 0);
+ if (size <= 0)
+ return AVERROR_INVALIDDATA;
+
*laces = *data + 1;
data += 1;
size -= 1;
break;
}
}
- if (size <= total) {
+ if (size < total) {
return AVERROR_INVALIDDATA;
}
}
data += offset;
size -= offset;
- if (size <= total) {
+ if (size < total) {
return AVERROR_INVALIDDATA;
}
lace_size[*laces - 1] = size - total;
{
MatroskaTrackEncoding *encodings = track->encodings.elem;
uint8_t *pkt_data = data;
- int res;
+ int res = 0;
AVPacket pktl, *pkt = &pktl;
if (encodings && !encodings->type && encodings->scope & 1) {
pkt_data = pr_data;
}
+ if (!pkt_size && !additional_size)
+ goto no_output;
+
av_init_packet(pkt);
if (pkt_data != data)
pkt->buf = av_buffer_create(pkt_data, pkt_size + AV_INPUT_BUFFER_PADDING_SIZE,
return 0;
+no_output:
fail:
if (pkt_data != data)
av_freep(&pkt_data);
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64"\n", num);
return AVERROR_INVALIDDATA;
- } else if (size <= 3)
- return 0;
+ } else if (size < 3)
+ return AVERROR_INVALIDDATA;
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return res;