mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 01:21:06 +00:00
avdevice/android_camera: fix OOB read in metadata parsing
ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS metadata is an
int32[n*4] array (one 4-tuple per stream config: format, width,
height, input/output flag). ACameraMetadata_const_entry.count is the
total number of int32_t elements, not the number of tuples. The loop
bound must be count/4 to avoid iterating past the end of the array.
Similarly, ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES is an
int32[n*2] array (min/max pairs). The loop bound must be count/2.
Without this fix, both loops over-iterate and read heap memory
beyond the metadata array bounds.
Signed-off-by: Mirko Visontai <mirkov@google.com>
(cherry picked from commit 1588bce21b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
a5ef0da32a
commit
ae981e6f0e
@@ -249,7 +249,7 @@ static void match_video_size(AVFormatContext *avctx)
|
||||
ACAMERA_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
|
||||
&available_configs);
|
||||
|
||||
for (int i = 0; i < available_configs.count; i++) {
|
||||
for (int i = 0; i < available_configs.count / 4; i++) {
|
||||
int32_t input = available_configs.data.i32[i * 4 + 3];
|
||||
int32_t format = available_configs.data.i32[i * 4 + 0];
|
||||
|
||||
@@ -296,7 +296,7 @@ static void match_framerate(AVFormatContext *avctx)
|
||||
ACAMERA_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,
|
||||
&available_framerates);
|
||||
|
||||
for (int i = 0; i < available_framerates.count; i++) {
|
||||
for (int i = 0; i < available_framerates.count / 2; i++) {
|
||||
int32_t min = available_framerates.data.i32[i * 2 + 0];
|
||||
int32_t max = available_framerates.data.i32[i * 2 + 1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user