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
86e1a358
Commit
86e1a358
authored
9 years ago
by
Vittorio Giovara
Browse files
Options
Downloads
Patches
Plain Diff
h264_ps: Return meaningful error codes and address a memory leak
Bug-Id: CID 1026763
parent
338ed3ed
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/h264_ps.c
+7
-3
7 additions, 3 deletions
libavcodec/h264_ps.c
with
7 additions
and
3 deletions
libavcodec/h264_ps.c
+
7
−
3
View file @
86e1a358
...
@@ -531,7 +531,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
...
@@ -531,7 +531,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
fail:
fail:
av_free
(
sps
);
av_free
(
sps
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
static
void
build_qp_table
(
PPS
*
pps
,
int
t
,
int
index
,
const
int
depth
)
static
void
build_qp_table
(
PPS
*
pps
,
int
t
,
int
index
,
const
int
depth
)
...
@@ -550,6 +550,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -550,6 +550,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
PPS
*
pps
;
PPS
*
pps
;
int
qp_bd_offset
;
int
qp_bd_offset
;
int
bits_left
;
int
bits_left
;
int
ret
;
if
(
pps_id
>=
MAX_PPS_COUNT
)
{
if
(
pps_id
>=
MAX_PPS_COUNT
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"pps_id %u out of range
\n
"
,
pps_id
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"pps_id %u out of range
\n
"
,
pps_id
);
...
@@ -563,6 +564,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -563,6 +564,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
if
((
unsigned
)
pps
->
sps_id
>=
MAX_SPS_COUNT
||
if
((
unsigned
)
pps
->
sps_id
>=
MAX_SPS_COUNT
||
!
h
->
sps_buffers
[
pps
->
sps_id
])
{
!
h
->
sps_buffers
[
pps
->
sps_id
])
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"sps_id %u out of range
\n
"
,
pps
->
sps_id
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"sps_id %u out of range
\n
"
,
pps
->
sps_id
);
ret
=
AVERROR_INVALIDDATA
;
goto
fail
;
goto
fail
;
}
}
sps
=
h
->
sps_buffers
[
pps
->
sps_id
];
sps
=
h
->
sps_buffers
[
pps
->
sps_id
];
...
@@ -571,7 +573,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -571,7 +573,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"Unimplemented luma bit depth=%d (max=10)
\n
"
,
"Unimplemented luma bit depth=%d (max=10)
\n
"
,
sps
->
bit_depth_luma
);
sps
->
bit_depth_luma
);
return
AVERROR_PATCHWELCOME
;
ret
=
AVERROR_PATCHWELCOME
;
goto
fail
;
}
}
pps
->
cabac
=
get_bits1
(
&
h
->
gb
);
pps
->
cabac
=
get_bits1
(
&
h
->
gb
);
...
@@ -616,6 +619,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -616,6 +619,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
pps
->
ref_count
[
1
]
=
get_ue_golomb
(
&
h
->
gb
)
+
1
;
pps
->
ref_count
[
1
]
=
get_ue_golomb
(
&
h
->
gb
)
+
1
;
if
(
pps
->
ref_count
[
0
]
-
1
>
32
-
1
||
pps
->
ref_count
[
1
]
-
1
>
32
-
1
)
{
if
(
pps
->
ref_count
[
0
]
-
1
>
32
-
1
||
pps
->
ref_count
[
1
]
-
1
>
32
-
1
)
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"reference overflow (pps)
\n
"
);
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"reference overflow (pps)
\n
"
);
ret
=
AVERROR_INVALIDDATA
;
goto
fail
;
goto
fail
;
}
}
...
@@ -678,5 +682,5 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
...
@@ -678,5 +682,5 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
fail:
fail:
av_free
(
pps
);
av_free
(
pps
);
return
-
1
;
return
ret
;
}
}
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