2424* Binary Tree search
2525***************************************/
2626
27- static void
28- ZSTD_updateDUBT (ZSTD_matchState_t * ms ,
27+ static
28+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
29+ void ZSTD_updateDUBT (ZSTD_matchState_t * ms ,
2930 const BYTE * ip , const BYTE * iend ,
3031 U32 mls )
3132{
@@ -68,8 +69,9 @@ ZSTD_updateDUBT(ZSTD_matchState_t* ms,
6869 * sort one already inserted but unsorted position
6970 * assumption : curr >= btlow == (curr - btmask)
7071 * doesn't fail */
71- static void
72- ZSTD_insertDUBT1 (const ZSTD_matchState_t * ms ,
72+ static
73+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
74+ void ZSTD_insertDUBT1 (const ZSTD_matchState_t * ms ,
7375 U32 curr , const BYTE * inputEnd ,
7476 U32 nbCompares , U32 btLow ,
7577 const ZSTD_dictMode_e dictMode )
@@ -157,8 +159,9 @@ ZSTD_insertDUBT1(const ZSTD_matchState_t* ms,
157159}
158160
159161
160- static size_t
161- ZSTD_DUBT_findBetterDictMatch (
162+ static
163+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
164+ size_t ZSTD_DUBT_findBetterDictMatch (
162165 const ZSTD_matchState_t * ms ,
163166 const BYTE * const ip , const BYTE * const iend ,
164167 size_t * offsetPtr ,
@@ -235,8 +238,9 @@ ZSTD_DUBT_findBetterDictMatch (
235238}
236239
237240
238- static size_t
239- ZSTD_DUBT_findBestMatch (ZSTD_matchState_t * ms ,
241+ static
242+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
243+ size_t ZSTD_DUBT_findBestMatch (ZSTD_matchState_t * ms ,
240244 const BYTE * const ip , const BYTE * const iend ,
241245 size_t * offBasePtr ,
242246 U32 const mls ,
@@ -386,8 +390,9 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms,
386390
387391
388392/** ZSTD_BtFindBestMatch() : Tree updater, providing best match */
389- FORCE_INLINE_TEMPLATE size_t
390- ZSTD_BtFindBestMatch ( ZSTD_matchState_t * ms ,
393+ FORCE_INLINE_TEMPLATE
394+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
395+ size_t ZSTD_BtFindBestMatch ( ZSTD_matchState_t * ms ,
391396 const BYTE * const ip , const BYTE * const iLimit ,
392397 size_t * offBasePtr ,
393398 const U32 mls /* template */ ,
@@ -622,7 +627,9 @@ size_t ZSTD_dedicatedDictSearch_lazy_search(size_t* offsetPtr, size_t ml, U32 nb
622627
623628/* Update chains up to ip (excluded)
624629 Assumption : always within prefix (i.e. not within extDict) */
625- FORCE_INLINE_TEMPLATE U32 ZSTD_insertAndFindFirstIndex_internal (
630+ FORCE_INLINE_TEMPLATE
631+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
632+ U32 ZSTD_insertAndFindFirstIndex_internal (
626633 ZSTD_matchState_t * ms ,
627634 const ZSTD_compressionParameters * const cParams ,
628635 const BYTE * ip , U32 const mls , U32 const lazySkipping )
@@ -656,6 +663,7 @@ U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip) {
656663
657664/* inlining is important to hardwire a hot branch (template emulation) */
658665FORCE_INLINE_TEMPLATE
666+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
659667size_t ZSTD_HcFindBestMatch (
660668 ZSTD_matchState_t * ms ,
661669 const BYTE * const ip , const BYTE * const iLimit ,
@@ -824,7 +832,9 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch(U32 const* hashTable, BYTE const* t
824832 * Fill up the hash cache starting at idx, prefetching up to ZSTD_ROW_HASH_CACHE_SIZE entries,
825833 * but not beyond iLimit.
826834 */
827- FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache (ZSTD_matchState_t * ms , const BYTE * base ,
835+ FORCE_INLINE_TEMPLATE
836+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
837+ void ZSTD_row_fillHashCache (ZSTD_matchState_t * ms , const BYTE * base ,
828838 U32 const rowLog , U32 const mls ,
829839 U32 idx , const BYTE * const iLimit )
830840{
@@ -850,7 +860,9 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const B
850860 * Returns the hash of base + idx, and replaces the hash in the hash cache with the byte at
851861 * base + idx + ZSTD_ROW_HASH_CACHE_SIZE. Also prefetches the appropriate rows from hashTable and tagTable.
852862 */
853- FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash (U32 * cache , U32 const * hashTable ,
863+ FORCE_INLINE_TEMPLATE
864+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
865+ U32 ZSTD_row_nextCachedHash (U32 * cache , U32 const * hashTable ,
854866 BYTE const * tagTable , BYTE const * base ,
855867 U32 idx , U32 const hashLog ,
856868 U32 const rowLog , U32 const mls ,
@@ -868,10 +880,12 @@ FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTab
868880/* ZSTD_row_update_internalImpl():
869881 * Updates the hash table with positions starting from updateStartIdx until updateEndIdx.
870882 */
871- FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl (ZSTD_matchState_t * ms ,
872- U32 updateStartIdx , U32 const updateEndIdx ,
873- U32 const mls , U32 const rowLog ,
874- U32 const rowMask , U32 const useCache )
883+ FORCE_INLINE_TEMPLATE
884+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
885+ void ZSTD_row_update_internalImpl (ZSTD_matchState_t * ms ,
886+ U32 updateStartIdx , U32 const updateEndIdx ,
887+ U32 const mls , U32 const rowLog ,
888+ U32 const rowMask , U32 const useCache )
875889{
876890 U32 * const hashTable = ms -> hashTable ;
877891 BYTE * const tagTable = ms -> tagTable ;
@@ -897,9 +911,11 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms,
897911 * Inserts the byte at ip into the appropriate position in the hash table, and updates ms->nextToUpdate.
898912 * Skips sections of long matches as is necessary.
899913 */
900- FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal (ZSTD_matchState_t * ms , const BYTE * ip ,
901- U32 const mls , U32 const rowLog ,
902- U32 const rowMask , U32 const useCache )
914+ FORCE_INLINE_TEMPLATE
915+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
916+ void ZSTD_row_update_internal (ZSTD_matchState_t * ms , const BYTE * ip ,
917+ U32 const mls , U32 const rowLog ,
918+ U32 const rowMask , U32 const useCache )
903919{
904920 U32 idx = ms -> nextToUpdate ;
905921 const BYTE * const base = ms -> window .base ;
@@ -1121,6 +1137,7 @@ ZSTD_row_getMatchMask(const BYTE* const tagRow, const BYTE tag, const U32 headGr
11211137 * - Pick the longest match.
11221138 */
11231139FORCE_INLINE_TEMPLATE
1140+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
11241141size_t ZSTD_RowFindBestMatch (
11251142 ZSTD_matchState_t * ms ,
11261143 const BYTE * const ip , const BYTE * const iLimit ,
@@ -1494,8 +1511,9 @@ FORCE_INLINE_TEMPLATE size_t ZSTD_searchMax(
14941511* Common parser - lazy strategy
14951512*********************************/
14961513
1497- FORCE_INLINE_TEMPLATE size_t
1498- ZSTD_compressBlock_lazy_generic (
1514+ FORCE_INLINE_TEMPLATE
1515+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
1516+ size_t ZSTD_compressBlock_lazy_generic (
14991517 ZSTD_matchState_t * ms , seqStore_t * seqStore ,
15001518 U32 rep [ZSTD_REP_NUM ],
15011519 const void * src , size_t srcSize ,
@@ -1915,6 +1933,7 @@ size_t ZSTD_compressBlock_btlazy2_dictMatchState(
19151933 || !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR ) \
19161934 || !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR )
19171935FORCE_INLINE_TEMPLATE
1936+ ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
19181937size_t ZSTD_compressBlock_lazy_extDict_generic (
19191938 ZSTD_matchState_t * ms , seqStore_t * seqStore ,
19201939 U32 rep [ZSTD_REP_NUM ],
0 commit comments