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
0759c8eb
Commit
0759c8eb
authored
Feb 02, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apedec: fix handling of packet sizes that are not a multiple of 4 bytes
parent
e15e2a6d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
apedec.c
libavcodec/apedec.c
+11
-6
No files found.
libavcodec/apedec.c
View file @
0759c8eb
...
@@ -814,7 +814,6 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -814,7 +814,6 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
APEContext
*
s
=
avctx
->
priv_data
;
APEContext
*
s
=
avctx
->
priv_data
;
int16_t
*
samples
;
int16_t
*
samples
;
int
i
,
ret
;
int
i
,
ret
;
...
@@ -828,17 +827,23 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -828,17 +827,23 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
if
(
!
s
->
samples
){
if
(
!
s
->
samples
){
uint32_t
nblocks
,
offset
;
uint32_t
nblocks
,
offset
;
void
*
tmp_data
;
void
*
tmp_data
;
int
buf_size
;
if
(
!
buf_
size
)
{
if
(
!
avpkt
->
size
)
{
*
got_frame_ptr
=
0
;
*
got_frame_ptr
=
0
;
return
0
;
return
0
;
}
}
if
(
buf_
size
<
8
)
{
if
(
avpkt
->
size
<
8
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packet is too small
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packet is too small
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
buf_size
=
avpkt
->
size
&
~
3
;
if
(
buf_size
!=
avpkt
->
size
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"packet size is not a multiple of 4. "
"extra bytes at the end will be skipped.
\n
"
);
}
tmp_data
=
av_realloc
(
s
->
data
,
FFALIGN
(
buf_size
,
4
)
);
tmp_data
=
av_realloc
(
s
->
data
,
buf_size
);
if
(
!
tmp_data
)
if
(
!
tmp_data
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
s
->
data
=
tmp_data
;
s
->
data
=
tmp_data
;
...
@@ -874,12 +879,12 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -874,12 +879,12 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
bytes_used
=
buf_
size
;
bytes_used
=
avpkt
->
size
;
}
}
if
(
!
s
->
data
)
{
if
(
!
s
->
data
)
{
*
got_frame_ptr
=
0
;
*
got_frame_ptr
=
0
;
return
buf_
size
;
return
avpkt
->
size
;
}
}
blockstodecode
=
FFMIN
(
BLOCKS_PER_LOOP
,
s
->
samples
);
blockstodecode
=
FFMIN
(
BLOCKS_PER_LOOP
,
s
->
samples
);
...
...
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