int *buf_size, int type,
uint32_t lace_size[256], int *laces)
{
- int res = 0, n, size = *buf_size;
+ int n, size = *buf_size;
uint8_t *data = *buf;
if (!type) {
{
uint8_t temp;
uint32_t total = 0;
- for (n = 0; res == 0 && n < *laces - 1; n++) {
+ for (n = 0; n < *laces - 1; n++) {
lace_size[n] = 0;
while (1) {
if (size <= total) {
- res = AVERROR_INVALIDDATA;
- break;
+ return AVERROR_INVALIDDATA;
}
temp = *data;
total += temp;
}
}
if (size <= total) {
- res = AVERROR_INVALIDDATA;
- break;
+ return AVERROR_INVALIDDATA;
}
lace_size[n] = size - total;
case 0x2: /* fixed-size lacing */
if (size % (*laces)) {
- res = AVERROR_INVALIDDATA;
- break;
+ return AVERROR_INVALIDDATA;
}
for (n = 0; n < *laces; n++)
lace_size[n] = size / *laces;
if (n < 0 || num > INT_MAX) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
- res = n<0 ? n : AVERROR_INVALIDDATA;
- break;
+ return n < 0 ? n : AVERROR_INVALIDDATA;
}
data += n;
size -= n;
total = lace_size[0] = num;
- for (n = 1; res == 0 && n < *laces - 1; n++) {
+ for (n = 1; n < *laces - 1; n++) {
int64_t snum;
int r;
r = matroska_ebmlnum_sint(matroska, data, size, &snum);
if (r < 0 || lace_size[n - 1] + snum > (uint64_t)INT_MAX) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
- res = r<0 ? r : AVERROR_INVALIDDATA;
- break;
+ return r < 0 ? r : AVERROR_INVALIDDATA;
}
data += r;
size -= r;
total += lace_size[n];
}
if (size <= total) {
- res = AVERROR_INVALIDDATA;
- break;
+ return AVERROR_INVALIDDATA;
}
lace_size[*laces - 1] = size - total;
break;
*buf = data;
*buf_size = size;
- return res;
+ return 0;
}
static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,