Avoid out-of-bounds read when prefetching compound dictionary heads at end of block.

PiperOrigin-RevId: 993910490
diff --git a/c/enc/backward_references_opt_inc.h b/c/enc/backward_references_opt_inc.h
index 149b43a..03dcd4a 100644
--- a/c/enc/backward_references_opt_inc.h
+++ b/c/enc/backward_references_opt_inc.h
@@ -213,7 +213,8 @@
         /* The next search is at position + sr.len (the one-ahead in the
            prefetch helper covers only the cur_ix + 1 successor): prefetch its
            dictionary heads[] line before the StoreRange loop. */
-        if (ENABLE_COMPOUND_DICTIONARY) {
+        if (ENABLE_COMPOUND_DICTIONARY &&
+            position + sr.len + FN(HashTypeLength)() < pos_end) {
           PrefetchCompoundDictionaryHeadsOpt(&params->dictionary.compound,
               ringbuffer, ringbuffer_mask, position + sr.len);
         }