From 3b2a9b59d9bd3036a8dcc6ac34d033714054f1e7 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Wed, 29 Jul 2015 16:15:55 -0700 Subject: Guard against codecinfo overflow Bug: 21296336 Change-Id: I78be5141b3108142f12d7cb94839fa50f776d84a Conflicts: media/libstagefright/matroska/MatroskaExtractor.cpp --- media/libstagefright/MetaData.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp index a01ec97..642d15a 100644 --- a/media/libstagefright/MetaData.cpp +++ b/media/libstagefright/MetaData.cpp @@ -258,7 +258,12 @@ void MetaData::typed_data::setData( mType = type; allocateStorage(size); - memcpy(storage(), data, size); + void *dst = storage(); + if (!dst) { + ALOGE("Couldn't allocate %zu bytes for item", size); + return; + } + memcpy(dst, data, size); } void MetaData::typed_data::getData( -- cgit v1.1