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
3ecc59bc
Commit
3ecc59bc
authored
Jun 11, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/utvideodec: fix multiple slices for UQY2 and other issues
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
5d12cfac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
utvideodec.c
libavcodec/utvideodec.c
+18
-9
No files found.
libavcodec/utvideodec.c
View file @
3ecc59bc
...
...
@@ -494,28 +494,36 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
/* parse plane structure to get frame flags and validate slice offsets */
bytestream2_init
(
&
gb
,
buf
,
buf_size
);
if
(
c
->
pro
)
{
if
(
bytestream2_get_bytes_left
(
&
gb
)
<
c
->
frame_info_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Not enough data for frame information
\n
"
);
return
AVERROR_INVALIDDATA
;
}
c
->
frame_info
=
bytestream2_get_le32u
(
&
gb
);
c
->
slices
=
((
c
->
frame_info
>>
24
)
&
0xff
)
+
1
;
c
->
slices
=
((
c
->
frame_info
>>
16
)
&
0xff
)
+
1
;
for
(
i
=
0
;
i
<
c
->
planes
;
i
++
)
{
plane_size
=
0
;
plane_start
[
i
]
=
gb
.
buffer
;
if
(
bytestream2_get_bytes_left
(
&
gb
)
<
1024
+
4
*
c
->
slices
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Insufficient data for a plane
\n
"
);
return
AVERROR_INVALIDDATA
;
}
slice_start
=
0
;
slice_end
=
0
;
for
(
j
=
0
;
j
<
c
->
slices
;
j
++
)
{
slice_size
=
bytestream2_get_le32u
(
&
gb
);
slice_end
=
bytestream2_get_le32u
(
&
gb
);
if
(
slice_end
<
0
||
slice_end
<
slice_start
||
bytestream2_get_bytes_left
(
&
gb
)
<
slice_end
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incorrect slice size
\n
"
);
return
AVERROR_INVALIDDATA
;
}
slice_size
=
slice_end
-
slice_start
;
slice_start
=
slice_end
;
max_slice_size
=
FFMAX
(
max_slice_size
,
slice_size
);
plane_size
+=
slice_size
;
}
bytestream2_skipu
(
&
gb
,
1024
)
;
plane_size
=
slice_end
;
bytestream2_skipu
(
&
gb
,
plane_size
);
bytestream2_skipu
(
&
gb
,
1024
);
}
plane_start
[
c
->
planes
]
=
gb
.
buffer
;
if
(
bytestream2_get_bytes_left
(
&
gb
)
<
c
->
frame_info_size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Not enough data for frame information
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
else
{
for
(
i
=
0
;
i
<
c
->
planes
;
i
++
)
{
plane_start
[
i
]
=
gb
.
buffer
;
...
...
@@ -684,6 +692,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
AV_RB32
(
avctx
->
extradata
+
4
));
c
->
interlaced
=
0
;
c
->
pro
=
1
;
c
->
frame_info_size
=
4
;
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Insufficient extradata size %d, should be at least 16
\n
"
,
...
...
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