Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
d3b0fb10
Commit
d3b0fb10
authored
12 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
put_bits: add av_assert2() to check out of array writes.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e80ce4ad
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/put_bits.h
+2
-0
2 additions, 0 deletions
libavcodec/put_bits.h
with
2 additions
and
0 deletions
libavcodec/put_bits.h
+
2
−
0
View file @
d3b0fb10
...
@@ -142,6 +142,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
...
@@ -142,6 +142,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
#ifdef BITSTREAM_WRITER_LE
#ifdef BITSTREAM_WRITER_LE
bit_buf
|=
value
<<
(
32
-
bit_left
);
bit_buf
|=
value
<<
(
32
-
bit_left
);
if
(
n
>=
bit_left
)
{
if
(
n
>=
bit_left
)
{
av_assert2
(
s
->
buf_ptr
+
3
<
s
->
buf_end
);
AV_WL32
(
s
->
buf_ptr
,
bit_buf
);
AV_WL32
(
s
->
buf_ptr
,
bit_buf
);
s
->
buf_ptr
+=
4
;
s
->
buf_ptr
+=
4
;
bit_buf
=
(
bit_left
==
32
)
?
0
:
value
>>
bit_left
;
bit_buf
=
(
bit_left
==
32
)
?
0
:
value
>>
bit_left
;
...
@@ -155,6 +156,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
...
@@ -155,6 +156,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
}
else
{
}
else
{
bit_buf
<<=
bit_left
;
bit_buf
<<=
bit_left
;
bit_buf
|=
value
>>
(
n
-
bit_left
);
bit_buf
|=
value
>>
(
n
-
bit_left
);
av_assert2
(
s
->
buf_ptr
+
3
<
s
->
buf_end
);
AV_WB32
(
s
->
buf_ptr
,
bit_buf
);
AV_WB32
(
s
->
buf_ptr
,
bit_buf
);
//printf("bitbuf = %08x\n", bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
s
->
buf_ptr
+=
4
;
s
->
buf_ptr
+=
4
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment