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
90e15e34
Commit
90e15e34
authored
Oct 05, 2013
by
Vittorio Giovara
Committed by
Diego Biurrun
Oct 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oggparsevorbis: return meaningful errors
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
2ddb35b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
oggparsevorbis.c
libavformat/oggparsevorbis.c
+11
-11
No files found.
libavformat/oggparsevorbis.c
View file @
90e15e34
...
@@ -78,12 +78,12 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
...
@@ -78,12 +78,12 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
/* must have vendor_length and user_comment_list_length */
/* must have vendor_length and user_comment_list_length */
if
(
size
<
8
)
if
(
size
<
8
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
s
=
bytestream_get_le32
(
&
p
);
s
=
bytestream_get_le32
(
&
p
);
if
(
end
-
p
-
4
<
s
||
s
<
0
)
if
(
end
-
p
-
4
<
s
||
s
<
0
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
p
+=
s
;
p
+=
s
;
...
@@ -218,21 +218,21 @@ static int vorbis_header(AVFormatContext *s, int idx)
...
@@ -218,21 +218,21 @@ static int vorbis_header(AVFormatContext *s, int idx)
if
(
!
os
->
private
)
{
if
(
!
os
->
private
)
{
os
->
private
=
av_mallocz
(
sizeof
(
struct
oggvorbis_private
));
os
->
private
=
av_mallocz
(
sizeof
(
struct
oggvorbis_private
));
if
(
!
os
->
private
)
if
(
!
os
->
private
)
return
0
;
return
AVERROR
(
ENOMEM
)
;
}
}
if
(
!
(
pkt_type
&
1
))
if
(
!
(
pkt_type
&
1
))
return
0
;
return
0
;
if
(
os
->
psize
<
1
||
pkt_type
>
5
)
if
(
os
->
psize
<
1
||
pkt_type
>
5
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
priv
=
os
->
private
;
priv
=
os
->
private
;
if
(
priv
->
packet
[
pkt_type
>>
1
])
if
(
priv
->
packet
[
pkt_type
>>
1
])
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
pkt_type
>
1
&&
!
priv
->
packet
[
0
]
||
pkt_type
>
3
&&
!
priv
->
packet
[
1
])
if
(
pkt_type
>
1
&&
!
priv
->
packet
[
0
]
||
pkt_type
>
3
&&
!
priv
->
packet
[
1
])
return
-
1
;
return
AVERROR_INVALIDDATA
;
priv
->
len
[
pkt_type
>>
1
]
=
os
->
psize
;
priv
->
len
[
pkt_type
>>
1
]
=
os
->
psize
;
priv
->
packet
[
pkt_type
>>
1
]
=
av_mallocz
(
os
->
psize
);
priv
->
packet
[
pkt_type
>>
1
]
=
av_mallocz
(
os
->
psize
);
...
@@ -243,10 +243,10 @@ static int vorbis_header(AVFormatContext *s, int idx)
...
@@ -243,10 +243,10 @@ static int vorbis_header(AVFormatContext *s, int idx)
int
srate
;
int
srate
;
if
(
os
->
psize
!=
30
)
if
(
os
->
psize
!=
30
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
bytestream_get_le32
(
&
p
)
!=
0
)
/* vorbis_version */
if
(
bytestream_get_le32
(
&
p
)
!=
0
)
/* vorbis_version */
return
-
1
;
return
AVERROR_INVALIDDATA
;
st
->
codec
->
channels
=
bytestream_get_byte
(
&
p
);
st
->
codec
->
channels
=
bytestream_get_byte
(
&
p
);
srate
=
bytestream_get_le32
(
&
p
);
srate
=
bytestream_get_le32
(
&
p
);
...
@@ -259,12 +259,12 @@ static int vorbis_header(AVFormatContext *s, int idx)
...
@@ -259,12 +259,12 @@ static int vorbis_header(AVFormatContext *s, int idx)
bs1
=
blocksize
>>
4
;
bs1
=
blocksize
>>
4
;
if
(
bs0
>
bs1
)
if
(
bs0
>
bs1
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
bs0
<
6
||
bs1
>
13
)
if
(
bs0
<
6
||
bs1
>
13
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
bytestream_get_byte
(
&
p
)
!=
1
)
/* framing_flag */
if
(
bytestream_get_byte
(
&
p
)
!=
1
)
/* framing_flag */
return
-
1
;
return
AVERROR_INVALIDDATA
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_VORBIS
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_VORBIS
;
...
...
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