If i remember correct SND_ResampleStream expect outspeed bytes in buffer. But memory allocation occured when only less than 128 bytes leaves in buffer. That cause buffer overflow. Also segfaults occured not on this part of code, corrupted memory caused it later.
For some black magic reason string index equal sound index for this function. And some mods actually uses return value. For example Nexuiz. Everything actually works fine except 255 converted to 0, this is actually more like G_INT bug.
PF_precache_sound return 0 instead of 255
Segfault with vorbis
stringwidth without extra argument
Rexuiz
Rexuiz
Rexuiz