Menu

#5 Apparent array overrun.

1.0
closed
nobody
2018-12-10
2018-02-03
No

Hi Jeff,

I get a warning that I think should not be ignored:

src/AudioPlay.c:809:20: warning: iteration 5u invokes undefined behavior [-Waggressive-loop-optimizations]
    mem += Polyphony[total++];

src/AudioPlay.c:811:3: note: containing loop
   } while (total < 6);
static unsigned char        Polyphony[5] = {MAX_DRUM_POLYPHONY, MAX_BASS_POLYPHONY, MAX_GUITAR_POLYPHONY, MAX_PAD_POLYPHONY, MAX_HUMAN_POLYPHONY};

I think the warning is correct and this writes one element beyond the array.

Discussion

  • jeff

    jeff - 2018-12-10

    Fixed in version 0.C

     
  • jeff

    jeff - 2018-12-10
    • status: open --> closed
     

Log in to post a comment.