ws-audio2: lossless: allocation limits (WavPack frame n x channels, APE / TTA frame size: LIMIT above 2^24 samples)

This commit is contained in:
4DBug committed 2026-10-31 15:17:36 -05:00
1 parent 085e385674
commit 00b36fa14a
3 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ function Ape.open(r: Bytes.Reader, opts: OpenOptions?): (Types.Decoder?, Err.Err
if not info then
return nil, err
end
if info.channels * info.blocksPerFrame > 2 ^ 26 then
if info.channels * info.blocksPerFrame > 2 ^ 24 then
return nil, Err.new(Err.LIMIT, "frames of " .. info.blocksPerFrame .. " blocks")
end
local codec, cerr = ApeCodec.decoder(info)
+1 -1
View File
@@ -85,7 +85,7 @@ function Tta.open(r: Bytes.Reader, opts: OpenOptions?): (Types.Decoder?, Err.Err
if not info then
return nil, err
end
if info.channels * info.frameLength > 2 ^ 26 then
if info.channels * info.frameLength > 2 ^ 24 then
return nil, Err.new(Err.LIMIT, info.channels .. " channels of " .. info.frameLength .. "-sample frames")
end
local codec = TtaCodec.decoder(info, stop)
@@ -191,6 +191,9 @@ local function frame(self: Decoder, buf: buffer, blocks: { number }, cbuf: buffe
end
if n < 0 then
n = h.samples
if n * C > 16777216 then
return nil, Err.new(Err.LIMIT, "a frame of " .. n .. " samples x " .. C .. " channels", at)
end
if #self.pcm < n * C then
self.pcm = table.create(n * C, 0)
end