From b82353b46bcac8239132cfd624c62aa84caab8be Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 16 Oct 2015 21:22:14 -0700 Subject: Move overflow checks into SkipCutBuffer Previously SkipCutBuffer would check its input parameters to ensure they were sane, however since bogus values might be the result of overflows, and overflow protection was recently turned on for libstagefright, the compiler's overflow checks were performed before SkipCutBuffer's, resulting in abort rather than just ignoring the bogus values. Moving the multiplication by framesize into SkipCutBuffer fixes this. Change-Id: I1ad6744bb045a5212701bbf6ee44eecb5f318210 --- media/libstagefright/OMXCodec.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'media/libstagefright/OMXCodec.cpp') diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 6bd54f1..abe19a0 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -1760,14 +1760,13 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { int32_t numchannels = 0; if (delay + padding) { if (mOutputFormat->findInt32(kKeyChannelCount, &numchannels)) { - size_t frameSize = numchannels * sizeof(int16_t); if (mSkipCutBuffer != NULL) { size_t prevbuffersize = mSkipCutBuffer->size(); if (prevbuffersize != 0) { ALOGW("Replacing SkipCutBuffer holding %zu bytes", prevbuffersize); } } - mSkipCutBuffer = new SkipCutBuffer(delay * frameSize, padding * frameSize); + mSkipCutBuffer = new SkipCutBuffer(delay, padding, numchannels); } } } -- cgit v1.1