Skip to content

Commit

Permalink
Don't allow queueing a buffer with no format
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Mar 12, 2023
1 parent 01521b6 commit 9fd9fee
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions al/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit 9fd9fee

Please sign in to comment.