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 --- include/media/stagefright/SkipCutBuffer.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/media/stagefright/SkipCutBuffer.h b/include/media/stagefright/SkipCutBuffer.h index 098aa69..61f9949 100644 --- a/include/media/stagefright/SkipCutBuffer.h +++ b/include/media/stagefright/SkipCutBuffer.h @@ -29,9 +29,10 @@ namespace android { */ class SkipCutBuffer: public RefBase { public: - // 'skip' is the number of bytes to skip from the beginning - // 'cut' is the number of bytes to cut from the end - SkipCutBuffer(int32_t skip, int32_t cut); + // 'skip' is the number of frames to skip from the beginning + // 'cut' is the number of frames to cut from the end + // 'num16BitChannels' is the number of channels, which are assumed to be 16 bit wide each + SkipCutBuffer(size_t skip, size_t cut, size_t num16Channels); // Submit one MediaBuffer for skipping and cutting. This may consume all or // some of the data in the buffer, or it may add data to it. -- cgit v1.1