From 16661ba8c0103c2571e84a59a107c9e41dbe60dc Mon Sep 17 00:00:00 2001 From: Jeff McGlynn Date: Thu, 16 Aug 2018 16:53:26 -0700 Subject: Fix ASAN failures in integer_sequence_codec and partition Introduce UTILS_RELEASE_ASSERT, which crashes if the condition isn't met, even on release builds. Update integer_sequence_codec and partition to use the new tests to validate input parameters, and update the tests so that they expect the crash to occur even on release builds. Bug: 112691516, 112669735 Change-Id: Ic82edeffc64ca0f2b0d17f1c63563dfd8d9cdd71 --- src/decoder/integer_sequence_codec.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/decoder/integer_sequence_codec.cc') diff --git a/src/decoder/integer_sequence_codec.cc b/src/decoder/integer_sequence_codec.cc index da7bc56..83c0359 100644 --- a/src/decoder/integer_sequence_codec.cc +++ b/src/decoder/integer_sequence_codec.cc @@ -14,6 +14,7 @@ #include "src/decoder/integer_sequence_codec.h" #include "src/base/math_utils.h" +#include "src/base/utils.h" #include #include @@ -383,8 +384,8 @@ void IntegerSequenceCodec::GetCountsForRange( // These are generally errors -- there should never be any ASTC values // outside of this range - assert(range > 0); - assert(range < 1 << kLog2MaxRangeForBits); + UTILS_RELEASE_ASSERT(range > 0); + UTILS_RELEASE_ASSERT(range < 1 << kLog2MaxRangeForBits); *bits = 0; *trits = 0; -- cgit v1.2.3