diff options
author | Marco Nelissen <marcone@google.com> | 2013-03-01 19:37:58 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-03-01 19:37:58 +0000 |
commit | 551bb75ae1bec8db8577febcf6faaa35a37947dc (patch) | |
tree | 02bcee3f9ad171dadf8a8c848bb4e0cce8fe1a58 /media/libmedia | |
parent | 5324bb2889c34cb85849ff1302215751a32c6a0d (diff) | |
parent | 1a76084dd8918533b00d76fbef15888742f752df (diff) | |
download | frameworks_av-551bb75ae1bec8db8577febcf6faaa35a37947dc.zip frameworks_av-551bb75ae1bec8db8577febcf6faaa35a37947dc.tar.gz frameworks_av-551bb75ae1bec8db8577febcf6faaa35a37947dc.tar.bz2 |
am c0048178: Merge "Avoid invalid memory access when using extractMetadata()"
* commit 'c0048178a1d312e7e05557ba99becd6a89b9e97a':
Avoid invalid memory access when using extractMetadata()
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/IMediaMetadataRetriever.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp index 7e6d54b..bb066a0 100644 --- a/media/libmedia/IMediaMetadataRetriever.cpp +++ b/media/libmedia/IMediaMetadataRetriever.cpp @@ -20,6 +20,7 @@ #include <binder/Parcel.h> #include <media/IMediaMetadataRetriever.h> #include <utils/String8.h> +#include <utils/KeyedVector.h> // The binder is supposed to propagate the scheduler group across // the binder interface so that remote calls are executed with @@ -161,8 +162,22 @@ public: if (ret != NO_ERROR) { return NULL; } - return reply.readCString(); + const char* str = reply.readCString(); + if (str != NULL) { + String8 value(str); + if (mMetadata.indexOfKey(keyCode) < 0) { + mMetadata.add(keyCode, value); + } else { + mMetadata.replaceValueFor(keyCode, value); + } + return mMetadata.valueFor(keyCode).string(); + } else { + return NULL; + } } + +private: + KeyedVector<int, String8> mMetadata; }; IMPLEMENT_META_INTERFACE(MediaMetadataRetriever, "android.media.IMediaMetadataRetriever"); |