Commit 9b7a99c6 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'float_1464_ubsan_rc_context_map' into 'main'

Fix for UBSAN issue in RC context mapping

See merge request !2451
parents df2efc6c 7e1f5bd7
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_1464_UBSAN_RC_CONTEXT_MAP                   /* FhG: BE UBSAN fix for float issue 1464 in the TCX range coder */
#define FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH         /* FhG: fix OOB index USAN error in TCX LTP pitch search */
#define FIX_2274_OOB_INDEXING_IN_CORRMATRIX             /* FhG: fix OOB indexing complaint */
#define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */
+3 −0
Original line number Diff line number Diff line
@@ -662,6 +662,9 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS(
                c = 12 + esc_nb;
            }

#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP
            s = s & 0x0F;
#endif
            s = s << 4; /*Shift old 4 bits*/
            s = s + c;  /*replace last 4 bits*/
            t = s & 0xFF;
+7 −0
Original line number Diff line number Diff line
@@ -963,6 +963,9 @@ void RCcontextMapping_encode2_no_mem_s17_LCS(
            }

            /*Shift old 4 bits, replace last 4 bits*/
#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP
            s = s & 0x0F;
#endif
            s = ( s << 4 ) + cp;
            t = s & 0xFF;

@@ -1336,7 +1339,11 @@ int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS(
            {
                cp = 12 + esc_nb;
            }

            /*shift old bits and replace last 4 bits*/
#ifdef FIX_1464_UBSAN_RC_CONTEXT_MAP
            s = s & 0x0F;
#endif
            s = ( s << 4 ) + cp;
            t = s & 0xFF;