Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb97d3e5 authored by Ivan Lozano's avatar Ivan Lozano
Browse files

Fix overflow sanitizer in EffectVisualizer.

This makes an implicit conversion to a signed integer explicit before
the unsigned integer overflow happens. This was causing runtime errors
on integer sanitized builds.

 runtime error: unsigned integer overflow: 1664 - 4096 cannot be
 represented in type 'unsigned int'

Bug: 30969751
Test: Compiles.
Change-Id: I1d4b5ab024e94c19ff448110064340125cd01e01
parent eda72c27
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -594,7 +594,7 @@ int Visualizer_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
                    deltaSmpl = CAPTURE_BUF_SIZE;
                }

                int32_t capturePoint = pContext->mCaptureIdx - deltaSmpl;
                int32_t capturePoint = (int32_t)pContext->mCaptureIdx - deltaSmpl;
                // a negative capturePoint means we wrap the buffer.
                if (capturePoint < 0) {
                    uint32_t size = -capturePoint;