doom: fix out-of-bounds access of caps->samprs

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sun, 5 Apr 2026 14:48:33 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 4cd3d3c5193ee13f1b577c3a197a4d0f7243276b
Author: mojyack <[email protected]>
Date:   Tue Mar 31 12:16:46 2026 +0900

    doom: fix out-of-bounds access of caps->samprs
    
    Change-Id: Icde0146648477dbd0442c67258ff6ae1ff62c994

diff --git a/apps/plugins/doom/i_sound.c b/apps/plugins/doom/i_sound.c
index 53a172694b..78780dd9b3 100644
--- a/apps/plugins/doom/i_sound.c
+++ b/apps/plugins/doom/i_sound.c
@@ -491,8 +491,9 @@ void I_InitSound()
            break;
    }
    if (i == caps->num_samprs)
-       i = SAMPR_44;
-   samplerate = caps->samprs[i];
+       samplerate = SAMPR_44;
+   else
+       samplerate = caps->samprs[i];
 
    // Initialize external data (all sounds) at start, keep static.
    printf( "I_InitSound: ");
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs