Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
c9a39cec
Commit
c9a39cec
authored
Sep 14, 2012
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matroskadec: return meaningful errors in matroska_decode_buffer
parent
df1d8412
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
matroskadec.c
libavformat/matroskadec.c
+19
-6
No files found.
libavformat/matroskadec.c
View file @
c9a39cec
...
...
@@ -991,7 +991,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
int
olen
;
if
(
pkt_size
>=
10000000
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
switch
(
encodings
[
0
].
compression
.
algo
)
{
case
MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP
:
{
...
...
@@ -1015,13 +1015,16 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
olen
=
pkt_size
*=
3
;
newpktdata
=
av_realloc
(
pkt_data
,
pkt_size
+
AV_LZO_OUTPUT_PADDING
);
if
(
!
newpktdata
)
{
result
=
AVERROR
(
ENOMEM
);
goto
failed
;
}
pkt_data
=
newpktdata
;
result
=
av_lzo1x_decode
(
pkt_data
,
&
olen
,
data
,
&
isize
);
}
while
(
result
==
AV_LZO_OUTPUT_FULL
&&
pkt_size
<
10000000
);
if
(
result
)
if
(
result
)
{
result
=
AVERROR_INVALIDDATA
;
goto
failed
;
}
pkt_size
-=
olen
;
break
;
#if CONFIG_ZLIB
...
...
@@ -1045,8 +1048,13 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
}
while
(
result
==
Z_OK
&&
pkt_size
<
10000000
);
pkt_size
=
zstream
.
total_out
;
inflateEnd
(
&
zstream
);
if
(
result
!=
Z_STREAM_END
)
if
(
result
!=
Z_STREAM_END
)
{
if
(
result
==
Z_MEM_ERROR
)
result
=
AVERROR
(
ENOMEM
);
else
result
=
AVERROR_INVALIDDATA
;
goto
failed
;
}
break
;
}
#endif
...
...
@@ -1071,13 +1079,18 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
}
while
(
result
==
BZ_OK
&&
pkt_size
<
10000000
);
pkt_size
=
bzstream
.
total_out_lo32
;
BZ2_bzDecompressEnd
(
&
bzstream
);
if
(
result
!=
BZ_STREAM_END
)
if
(
result
!=
BZ_STREAM_END
)
{
if
(
result
==
BZ_MEM_ERROR
)
result
=
AVERROR
(
ENOMEM
);
else
result
=
AVERROR_INVALIDDATA
;
goto
failed
;
}
break
;
}
#endif
default:
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
*
buf
=
pkt_data
;
...
...
@@ -1085,7 +1098,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
return
0
;
failed:
av_free
(
pkt_data
);
return
-
1
;
return
result
;
}
static
void
matroska_fix_ass_packet
(
MatroskaDemuxContext
*
matroska
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment