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
23f5cff9
Commit
23f5cff9
authored
Sep 10, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264dec: Prevent CABAC and CAVLC bitsteram overreading
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
28ccda78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
h264.c
libavcodec/h264.c
+11
-7
h264.h
libavcodec/h264.h
+2
-0
No files found.
libavcodec/h264.c
View file @
23f5cff9
...
...
@@ -174,20 +174,24 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_l
i
-=
RS
;
}
if
(
i
>=
length
-
1
){
//no escaped 0
*
dst_length
=
length
;
*
consumed
=
length
+
1
;
//+1 for the header
return
src
;
}
bufidx
=
h
->
nal_unit_type
==
NAL_DPC
?
1
:
0
;
// use second escape buffer for inter data
av_fast_malloc
(
&
h
->
rbsp_buffer
[
bufidx
],
&
h
->
rbsp_buffer_size
[
bufidx
],
length
+
FF_INPUT_BUFFER_PADDING_SIZE
);
si
=
h
->
rbsp_buffer_size
[
bufidx
];
av_fast_malloc
(
&
h
->
rbsp_buffer
[
bufidx
],
&
h
->
rbsp_buffer_size
[
bufidx
],
length
+
FF_INPUT_BUFFER_PADDING_SIZE
+
MAX_MBPAIR_SIZE
);
dst
=
h
->
rbsp_buffer
[
bufidx
];
if
(
si
!=
h
->
rbsp_buffer_size
[
bufidx
])
memset
(
dst
+
length
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
+
MAX_MBPAIR_SIZE
);
if
(
dst
==
NULL
){
return
NULL
;
}
if
(
i
>=
length
-
1
){
//no escaped 0
*
dst_length
=
length
;
*
consumed
=
length
+
1
;
//+1 for the header
memcpy
(
dst
,
src
,
length
);
return
dst
;
}
//printf("decoding esc\n");
memcpy
(
dst
,
src
,
i
);
si
=
di
=
i
;
...
...
libavcodec/h264.h
View file @
23f5cff9
...
...
@@ -46,6 +46,8 @@
#define MAX_DELAYED_PIC_COUNT 16
#define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
/* Compiling in interlaced support reduces the speed
* of progressive decoding by about 2%. */
#define ALLOW_INTERLACE
...
...
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