Commits

ecsv committed 4c9e834

Avoid out of bounds access of audio ABI callback array

Comments (0)

Files changed (1)

 {
     unsigned int *p_alist = (unsigned int*)(rsp.RDRAM + task->data_ptr);
     unsigned int i;
+    u32 inst1_idx;
 
     switch(audio_ucode_detect(task))
     {
     {
         inst1 = p_alist[i];
         inst2 = p_alist[i+1];
-        ABI[inst1 >> 24]();
+        inst1_idx = inst1 >> 24;
+        if (inst1_idx < 0x20)
+            ABI[inst1_idx]();
+        else
+            DebugMessage(M64MSG_WARNING, "Invalid audio ABI index %u", inst1_idx);
     }
 
     return 0;