aboutsummaryrefslogtreecommitdiff
path: root/c/enc
diff options
context:
space:
mode:
authorEvgenii Kliuchnikov <eustas@google.com>2025-01-31 05:42:35 -0800
committerCopybara-Service <copybara-worker@google.com>2025-01-31 05:43:09 -0800
commit440e03642b891968a76b6d088d70f01f06e0c349 (patch)
tree05b6b7c7ef14882412fe267da10ad257ee3f3e00 /c/enc
parenta1e3ab25ce136bdb66f65292564f12590e056124 (diff)
downloadbrotli-master.zip
brotli-master.tar.gz
brotli-master.tar.bz2
Another nullptr-arithmetics clamerHEADmaster
PiperOrigin-RevId: 721741817
Diffstat (limited to 'c/enc')
-rw-r--r--c/enc/block_splitter_inc.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/c/enc/block_splitter_inc.h b/c/enc/block_splitter_inc.h
index 64409ec..f7c4345 100644
--- a/c/enc/block_splitter_inc.h
+++ b/c/enc/block_splitter_inc.h
@@ -230,12 +230,16 @@ static void FN(ClusterBlocks)(MemoryManager* m,
static const uint32_t kInvalidIndex = BROTLI_UINT32_MAX;
uint32_t* new_index;
size_t i;
- uint32_t* BROTLI_RESTRICT const sizes = u32 + 0 * HISTOGRAMS_PER_BATCH;
- uint32_t* BROTLI_RESTRICT const new_clusters = u32 + 1 * HISTOGRAMS_PER_BATCH;
- uint32_t* BROTLI_RESTRICT const symbols = u32 + 2 * HISTOGRAMS_PER_BATCH;
- uint32_t* BROTLI_RESTRICT const remap = u32 + 3 * HISTOGRAMS_PER_BATCH;
+ uint32_t* BROTLI_RESTRICT const sizes =
+ u32 ? (u32 + 0 * HISTOGRAMS_PER_BATCH) : NULL;
+ uint32_t* BROTLI_RESTRICT const new_clusters =
+ u32 ? (u32 + 1 * HISTOGRAMS_PER_BATCH) : NULL;
+ uint32_t* BROTLI_RESTRICT const symbols =
+ u32 ? (u32 + 2 * HISTOGRAMS_PER_BATCH) : NULL;
+ uint32_t* BROTLI_RESTRICT const remap =
+ u32 ? (u32 + 3 * HISTOGRAMS_PER_BATCH) : NULL;
uint32_t* BROTLI_RESTRICT const block_lengths =
- u32 + 4 * HISTOGRAMS_PER_BATCH;
+ u32 ? (u32 + 4 * HISTOGRAMS_PER_BATCH) : NULL;
/* TODO(eustas): move to arena? */
HistogramType* tmp = BROTLI_ALLOC(m, HistogramType, 2);