diff options
author | Chris Robinson <[email protected]> | 2020-02-17 17:20:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-02-17 17:20:01 -0800 |
commit | d6e49b503b3e4ec6074457ac23bc1492863dff6a (patch) | |
tree | 97b06cc47213235b234dfda381b80bef196b5c56 /al | |
parent | 3122c3b4a109b7d6e288bdde055fc4bbae5517bc (diff) |
Don't allow setting a source offset for a callback
Diffstat (limited to 'al')
-rw-r--r-- | al/source.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/al/source.cpp b/al/source.cpp index d456401c..047551bf 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -999,6 +999,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a if(ALvoice *voice{GetSourceVoice(Source, Context)}) { auto vpos = GetSampleOffset(Source); + if((voice->mFlags&VOICE_IS_CALLBACK)) + SETERR_RETURN(Context, AL_INVALID_VALUE, false, + "Source offset for callback is invalid"); if(!vpos) SETERR_RETURN(Context, AL_INVALID_VALUE, false, "Invalid offset"); voice->mPosition.store(vpos->pos, std::memory_order_relaxed); @@ -1220,6 +1223,9 @@ bool SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a if(ALvoice *voice{GetSourceVoice(Source, Context)}) { auto vpos = GetSampleOffset(Source); + if((voice->mFlags&VOICE_IS_CALLBACK)) + SETERR_RETURN(Context, AL_INVALID_VALUE, false, + "Source offset for callback is invalid"); if(!vpos) SETERR_RETURN(Context, AL_INVALID_VALUE, false, "Invalid source offset"); voice->mPosition.store(vpos->pos, std::memory_order_relaxed); |