icculus/mojoAL

Null pointer access when setting sample offset for `AL_UNDETERMINED` source

slime73 opened this issue · 0 comments

This is similar to #9 - when calling alSourcei(source, AL_SAMPLE_OFFSET, value), the code tries to access a field of src->buffer when src->buffer is null: https://github.com/icculus/mojoAL/blob/main/mojoal.c#L4238

There is a codepath which bails early if it knows the source is streaming, but in my case the source's type is AL_UNDETERMINED at that point.

Side note: my source is in the AL_UNDETERMINED state because it unexpectedly hadn't queued any buffers, because of a weird chain of events leading back to alGetSourceiv(source, AL_BUFFERS_QUEUED, ...) returning the wrong value: https://github.com/icculus/mojoAL/blob/main/mojoal.c#L3976-L3977