aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-04 21:12:59 -0800
committerChris Robinson <[email protected]>2023-12-04 21:12:59 -0800
commit305cbdf7425e58226953fb73c2cff809a74de9a1 (patch)
tree29878be3ea1056aa7f9eae54632a99d8b007c1b1
parente123e7bbda4330559ef03a5362bc93064eb87e4e (diff)
Check for a valid alignment with callback buffers
-rw-r--r--al/buffer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index ae41585f..e577e17a 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -402,6 +402,10 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq,
const ALuint unpackalign{ALBuf->UnpackAlign};
const ALuint align{SanitizeAlignment(DstType, unpackalign)};
+ if(align < 1) UNLIKELY
+ return context->setError(AL_INVALID_VALUE, "Invalid unpack alignment %u for %s samples",
+ unpackalign, NameFromFormat(DstType));
+
const ALuint BlockSize{ChannelsFromFmt(DstChannels, ambiorder) *
((DstType == FmtIMA4) ? (align-1)/2 + 4 :
(DstType == FmtMSADPCM) ? (align-2)/2 + 7 :