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
9e361022
Commit
9e361022
authored
Sep 24, 2017
by
Sean McGovern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smacker: return meaningful error codes on failure
parent
2b50847e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
smacker.c
libavformat/smacker.c
+5
-5
No files found.
libavformat/smacker.c
View file @
9e361022
...
...
@@ -112,7 +112,7 @@ static int smacker_read_header(AVFormatContext *s)
/* read and check header */
smk
->
magic
=
avio_rl32
(
pb
);
if
(
smk
->
magic
!=
MKTAG
(
'S'
,
'M'
,
'K'
,
'2'
)
&&
smk
->
magic
!=
MKTAG
(
'S'
,
'M'
,
'K'
,
'4'
))
return
-
1
;
return
AVERROR_INVALIDDATA
;
smk
->
width
=
avio_rl32
(
pb
);
smk
->
height
=
avio_rl32
(
pb
);
smk
->
frames
=
avio_rl32
(
pb
);
...
...
@@ -126,7 +126,7 @@ static int smacker_read_header(AVFormatContext *s)
if
(
smk
->
treesize
>=
UINT_MAX
/
4
){
// smk->treesize + 16 must not overflow (this check is probably redundant)
av_log
(
s
,
AV_LOG_ERROR
,
"treesize too large
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
//FIXME remove extradata "rebuilding"
...
...
@@ -142,7 +142,7 @@ static int smacker_read_header(AVFormatContext *s)
/* setup data */
if
(
smk
->
frames
>
0xFFFFFF
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Too many frames: %"
PRIu32
"
\n
"
,
smk
->
frames
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
smk
->
frm_size
=
av_malloc
(
smk
->
frames
*
4
);
smk
->
frm_flags
=
av_malloc
(
smk
->
frames
);
...
...
@@ -160,7 +160,7 @@ static int smacker_read_header(AVFormatContext *s)
/* init video codec */
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
smk
->
videoindex
=
st
->
index
;
st
->
codecpar
->
width
=
smk
->
width
;
st
->
codecpar
->
height
=
smk
->
height
;
...
...
@@ -221,7 +221,7 @@ static int smacker_read_header(AVFormatContext *s)
smk
->
treesize
+
16
);
av_free
(
smk
->
frm_size
);
av_free
(
smk
->
frm_flags
);
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
ret
=
avio_read
(
pb
,
st
->
codecpar
->
extradata
+
16
,
st
->
codecpar
->
extradata_size
-
16
);
if
(
ret
!=
st
->
codecpar
->
extradata_size
-
16
){
...
...
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