From bc775ecc5b9f690186fef73f606c4daf40152a03 Mon Sep 17 00:00:00 2001 From: jinjunzh Date: Sat, 9 Jul 2022 17:29:47 -0400 Subject: [PATCH] add assert for Illegal path --- src/Compression/CompressionCodecDeflateQpl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Compression/CompressionCodecDeflateQpl.cpp b/src/Compression/CompressionCodecDeflateQpl.cpp index ce13b886fd4..1b6feaa3a42 100644 --- a/src/Compression/CompressionCodecDeflateQpl.cpp +++ b/src/Compression/CompressionCodecDeflateQpl.cpp @@ -89,6 +89,7 @@ qpl_job * DeflateQplJobHWPool::acquireJob(uint32_t * job_id) } } *job_id = JOB_NUMBER - index; + assert(index < JOB_NUMBER); return hw_job_ptr_pool[index]; } else @@ -100,6 +101,7 @@ qpl_job * DeflateQplJobHWPool::releaseJob(uint32_t job_id) if (jobPoolReady()) { uint32_t index = JOB_NUMBER - job_id; + assert(index < JOB_NUMBER); ReleaseJobObjectGuard _(index); return hw_job_ptr_pool[index]; } @@ -122,6 +124,9 @@ HardwareCodecDeflateQpl::HardwareCodecDeflateQpl(): HardwareCodecDeflateQpl::~HardwareCodecDeflateQpl() { +#ifndef NDEBUG + assert(decomp_async_job_map.empty()); +#else if (!decomp_async_job_map.empty()) { LOG_WARNING(log, "Find un-released job when HardwareCodecDeflateQpl destroy"); @@ -131,6 +136,7 @@ HardwareCodecDeflateQpl::~HardwareCodecDeflateQpl() } decomp_async_job_map.clear(); } +#endif } int32_t HardwareCodecDeflateQpl::doCompressData(const char * source, uint32_t source_size, char * dest, uint32_t dest_size) const