From e69aac87d04a11d08df07a26dfd809b1478c27f6 Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Thu, 4 Feb 2021 10:23:59 -0800 Subject: [PATCH] Rephrase to avoid integer overflow Bug: 179046129 Test: atest sf_foundation_test w/local additions Change-Id: Ie86897fb6283b22745d2fc0cb9b9ea22736193a0 (cherry picked from commit 522b797958daedb6ff6a2b21b1a8e0dd3ec5bf5e) --- media/libstagefright/foundation/ABuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/libstagefright/foundation/ABuffer.cpp b/media/libstagefright/foundation/ABuffer.cpp index c8965d9109..c79384cb0f 100644 --- a/media/libstagefright/foundation/ABuffer.cpp +++ b/media/libstagefright/foundation/ABuffer.cpp @@ -67,7 +67,7 @@ ABuffer::~ABuffer() { void ABuffer::setRange(size_t offset, size_t size) { CHECK_LE(offset, mCapacity); - CHECK_LE(offset + size, mCapacity); + CHECK_LE(size, mCapacity - offset); mRangeOffset = offset; mRangeLength = size; -- GitLab