summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Giro <sgiro@google.com>2016-06-28 18:24:52 +0100
committergitbuildkicker <android-build@google.com>2016-08-16 15:51:49 -0700
commit3d4cb8bbc03aab52c71bb339624170f2b7238cdf (patch)
tree8ddf070ca4fdcdc4da274633a2cb6a1ba5bd318f
parent2a1a0fd88e84fc845cd6bce3a161672d80c1df39 (diff)
downloadframeworks_av-3d4cb8bbc03aab52c71bb339624170f2b7238cdf.zip
frameworks_av-3d4cb8bbc03aab52c71bb339624170f2b7238cdf.tar.gz
frameworks_av-3d4cb8bbc03aab52c71bb339624170f2b7238cdf.tar.bz2
Add bound checks to utf16_to_utf8
Bug: 29250543 Change-Id: I3518416e89ed901021970958fb6005fd69129f7c (cherry picked from commit 1d3f4278b2666d1a145af2f54782c993aa07d1d9)
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index bcfd83a..b8c610d 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -237,7 +237,8 @@ void unmarshallAudioAttributes(const Parcel& parcel, audio_attributes_t *attribu
// copying array size -1, array for tags was calloc'd, no need to NULL-terminate it
size_t tagSize = realTagSize > AUDIO_ATTRIBUTES_TAGS_MAX_SIZE - 1 ?
AUDIO_ATTRIBUTES_TAGS_MAX_SIZE - 1 : realTagSize;
- utf16_to_utf8(tags.string(), tagSize, attributes->tags);
+ utf16_to_utf8(tags.string(), tagSize, attributes->tags,
+ sizeof(attributes->tags) / sizeof(attributes->tags[0]));
}
} else {
ALOGE("unmarshallAudioAttributes() received unflattened tags, ignoring tag values");