From 604e0c31b2e6a157a74b98e4015ec3c151ba9716 Mon Sep 17 00:00:00 2001
From: Chris Wulff <chris.wulff@labxtechnologies.com>
Date: Sat, 22 Oct 2011 09:29:12 -0400
Subject: [PATCH] matroskadec: Zero length in the "no lacing" case is valid
(sometimes present in subtitle tracks.)
---
libavformat/matroskadec.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 78e337b..b1475fc 100644
|
a
|
b
|
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
|
| 1750 | 1750 | size -= n; |
| 1751 | 1751 | |
| 1752 | 1752 | track = matroska_find_track_by_num(matroska, num); |
| 1753 | | if (size <= 3 || !track || !track->stream) { |
| | 1753 | if (size < 3 || !track || !track->stream) { |
| 1754 | 1754 | av_log(matroska->ctx, AV_LOG_INFO, |
| 1755 | 1755 | "Invalid stream %"PRIu64" or size %u\n", num, size); |
| 1756 | 1756 | return AVERROR_INVALIDDATA; |
| … |
… |
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
|
| 1795 | 1795 | case 0x1: /* Xiph lacing */ |
| 1796 | 1796 | case 0x2: /* fixed-size lacing */ |
| 1797 | 1797 | case 0x3: /* EBML lacing */ |
| 1798 | | assert(size>0); // size <=3 is checked before size-=3 above |
| | 1798 | if (size < 1) { |
| | 1799 | av_log(matroska->ctx, AV_LOG_INFO, |
| | 1800 | "Lacing header missing: size %u\n", size); |
| | 1801 | return AVERROR_INVALIDDATA; |
| | 1802 | } |
| 1799 | 1803 | laces = (*data) + 1; |
| 1800 | 1804 | data += 1; |
| 1801 | 1805 | size -= 1; |