Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
4c364eb2
Commit
4c364eb2
authored
Mar 05, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shorten: report meaningful errors
parent
a2ad554d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
shorten.c
libavcodec/shorten.c
+14
-14
No files found.
libavcodec/shorten.c
View file @
4c364eb2
...
@@ -126,13 +126,13 @@ static int allocate_buffers(ShortenContext *s)
...
@@ -126,13 +126,13 @@ static int allocate_buffers(ShortenContext *s)
for
(
chan
=
0
;
chan
<
s
->
channels
;
chan
++
)
{
for
(
chan
=
0
;
chan
<
s
->
channels
;
chan
++
)
{
if
(
FFMAX
(
1
,
s
->
nmean
)
>=
UINT_MAX
/
sizeof
(
int32_t
))
{
if
(
FFMAX
(
1
,
s
->
nmean
)
>=
UINT_MAX
/
sizeof
(
int32_t
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"nmean too large
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"nmean too large
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
s
->
blocksize
+
s
->
nwrap
>=
UINT_MAX
/
sizeof
(
int32_t
)
||
if
(
s
->
blocksize
+
s
->
nwrap
>=
UINT_MAX
/
sizeof
(
int32_t
)
||
s
->
blocksize
+
s
->
nwrap
<=
(
unsigned
)
s
->
nwrap
)
{
s
->
blocksize
+
s
->
nwrap
<=
(
unsigned
)
s
->
nwrap
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"s->blocksize + s->nwrap too large
\n
"
);
"s->blocksize + s->nwrap too large
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
tmp_ptr
=
tmp_ptr
=
...
@@ -205,14 +205,14 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -205,14 +205,14 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
if
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'R'
,
'I'
,
'F'
,
'F'
))
{
if
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'R'
,
'I'
,
'F'
,
'F'
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing RIFF tag
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing RIFF tag
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
header
+=
4
;
/* chunk size */
header
+=
4
;
/* chunk size */
if
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'W'
,
'A'
,
'V'
,
'E'
))
{
if
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'W'
,
'A'
,
'V'
,
'E'
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing WAVE tag
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"missing WAVE tag
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
while
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'f'
,
'm'
,
't'
,
' '
))
{
while
(
bytestream_get_le32
(
&
header
)
!=
MKTAG
(
'f'
,
'm'
,
't'
,
' '
))
{
...
@@ -223,7 +223,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -223,7 +223,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
if
(
len
<
16
)
{
if
(
len
<
16
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"fmt chunk was too short
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"fmt chunk was too short
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
wave_format
=
bytestream_get_le16
(
&
header
);
wave_format
=
bytestream_get_le16
(
&
header
);
...
@@ -233,7 +233,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -233,7 +233,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
break
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported wave format
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported wave format
\n
"
);
return
-
1
;
return
AVERROR
(
ENOSYS
)
;
}
}
header
+=
2
;
// skip channels (already got from shorten header)
header
+=
2
;
// skip channels (already got from shorten header)
...
@@ -244,7 +244,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
...
@@ -244,7 +244,7 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
if
(
avctx
->
bits_per_coded_sample
!=
16
)
{
if
(
avctx
->
bits_per_coded_sample
!=
16
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported number of bits per sample
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported number of bits per sample
\n
"
);
return
-
1
;
return
AVERROR
(
ENOSYS
)
;
}
}
len
-=
16
;
len
-=
16
;
...
@@ -329,7 +329,7 @@ static int read_header(ShortenContext *s)
...
@@ -329,7 +329,7 @@ static int read_header(ShortenContext *s)
/* shorten signature */
/* shorten signature */
if
(
get_bits_long
(
&
s
->
gb
,
32
)
!=
AV_RB32
(
"ajkg"
))
{
if
(
get_bits_long
(
&
s
->
gb
,
32
)
!=
AV_RB32
(
"ajkg"
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"missing shorten magic 'ajkg'
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"missing shorten magic 'ajkg'
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
s
->
lpcqoffset
=
0
;
s
->
lpcqoffset
=
0
;
...
@@ -342,7 +342,7 @@ static int read_header(ShortenContext *s)
...
@@ -342,7 +342,7 @@ static int read_header(ShortenContext *s)
if
(
s
->
channels
<=
0
||
s
->
channels
>
MAX_CHANNELS
)
{
if
(
s
->
channels
<=
0
||
s
->
channels
>
MAX_CHANNELS
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"too many channels: %d
\n
"
,
s
->
channels
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"too many channels: %d
\n
"
,
s
->
channels
);
s
->
channels
=
0
;
s
->
channels
=
0
;
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
s
->
avctx
->
channels
=
s
->
channels
;
s
->
avctx
->
channels
=
s
->
channels
;
...
@@ -380,7 +380,7 @@ static int read_header(ShortenContext *s)
...
@@ -380,7 +380,7 @@ static int read_header(ShortenContext *s)
if
(
get_ur_golomb_shorten
(
&
s
->
gb
,
FNSIZE
)
!=
FN_VERBATIM
)
{
if
(
get_ur_golomb_shorten
(
&
s
->
gb
,
FNSIZE
)
!=
FN_VERBATIM
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"missing verbatim section at beginning of stream
\n
"
);
"missing verbatim section at beginning of stream
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
s
->
header_size
=
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_CKSIZE_SIZE
);
s
->
header_size
=
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_CKSIZE_SIZE
);
...
@@ -388,14 +388,14 @@ static int read_header(ShortenContext *s)
...
@@ -388,14 +388,14 @@ static int read_header(ShortenContext *s)
s
->
header_size
<
CANONICAL_HEADER_SIZE
)
{
s
->
header_size
<
CANONICAL_HEADER_SIZE
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"header is wrong size: %d
\n
"
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"header is wrong size: %d
\n
"
,
s
->
header_size
);
s
->
header_size
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
for
(
i
=
0
;
i
<
s
->
header_size
;
i
++
)
for
(
i
=
0
;
i
<
s
->
header_size
;
i
++
)
s
->
header
[
i
]
=
(
char
)
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_BYTE_SIZE
);
s
->
header
[
i
]
=
(
char
)
get_ur_golomb_shorten
(
&
s
->
gb
,
VERBATIM_BYTE_SIZE
);
if
(
decode_wave_header
(
s
->
avctx
,
s
->
header
,
s
->
header_size
)
<
0
)
if
(
(
ret
=
decode_wave_header
(
s
->
avctx
,
s
->
header
,
s
->
header_size
)
)
<
0
)
return
-
1
;
return
ret
;
s
->
cur_chan
=
0
;
s
->
cur_chan
=
0
;
s
->
bitshift
=
0
;
s
->
bitshift
=
0
;
...
@@ -610,7 +610,7 @@ finish_frame:
...
@@ -610,7 +610,7 @@ finish_frame:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"overread: %d
\n
"
,
i
-
buf_size
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"overread: %d
\n
"
,
i
-
buf_size
);
s
->
bitstream_size
=
0
;
s
->
bitstream_size
=
0
;
s
->
bitstream_index
=
0
;
s
->
bitstream_index
=
0
;
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
s
->
bitstream_size
)
{
if
(
s
->
bitstream_size
)
{
s
->
bitstream_index
+=
i
;
s
->
bitstream_index
+=
i
;
...
...
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