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/ACodec.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 672e50a..c84601d 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -4566,16 +4566,13 @@ void ACodec::sendFormatChange(const sp &reply) { (mEncoderDelay || mEncoderPadding)) { int32_t channelCount; CHECK(notify->findInt32("channel-count", &channelCount)); - size_t frameSize = channelCount * sizeof(int16_t); if (mSkipCutBuffer != NULL) { size_t prevbufsize = mSkipCutBuffer->size(); if (prevbufsize != 0) { ALOGW("Replacing SkipCutBuffer holding %zu bytes", prevbufsize); } } - mSkipCutBuffer = new SkipCutBuffer( - mEncoderDelay * frameSize, - mEncoderPadding * frameSize); + mSkipCutBuffer = new SkipCutBuffer(mEncoderDelay, mEncoderPadding, channelCount); } getVQZIPInfo(notify); -- cgit v1.1