diff options
author | Chris Robinson <[email protected]> | 2023-03-12 15:13:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-12 15:13:18 -0700 |
commit | 9fd9fee35ce5657b07086652b255e2dfbc49b435 (patch) | |
tree | d5fcb3939e9295792c9ec95349b7bcda3118c9c9 /al/source.cpp | |
parent | 01521b684998c43a7bd4d062af9858961379fecb (diff) |
Don't allow queueing a buffer with no format
Diffstat (limited to 'al/source.cpp')
-rw-r--r-- | al/source.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/al/source.cpp b/al/source.cpp index f6358607..084d9e0e 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -3744,10 +3744,25 @@ START_API_FUNC context->setError(AL_INVALID_NAME, "Queueing invalid buffer ID %u", buffers[i]); goto buffer_error; } - if(buffer && buffer->mCallback) + if(buffer) { - context->setError(AL_INVALID_OPERATION, "Queueing callback buffer %u", buffers[i]); - goto buffer_error; + if(buffer->mSampleRate < 0) + { + context->setError(AL_INVALID_OPERATION, "Queueing buffer %u with no format", + buffer->id); + goto buffer_error; + } + if(buffer->mCallback) + { + context->setError(AL_INVALID_OPERATION, "Queueing callback buffer %u", buffer->id); + goto buffer_error; + } + if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) + { + context->setError(AL_INVALID_OPERATION, + "Queueing non-persistently mapped buffer %u", buffer->id); + goto buffer_error; + } } source->mQueue.emplace_back(); @@ -3767,13 +3782,6 @@ START_API_FUNC BufferList->mBuffer = buffer; IncrementRef(buffer->ref); - if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) - { - context->setError(AL_INVALID_OPERATION, "Queueing non-persistently mapped buffer %u", - buffer->id); - goto buffer_error; - } - if(BufferFmt == nullptr) BufferFmt = buffer; else |