🐛 Stop multimap decode from spinning on truncated data
A failed or zero-length run read left the decoder looping forever without consuming input.
This commit is contained in:
+7
-1
@@ -69,7 +69,13 @@ begin
|
||||
begin
|
||||
while (x < width) and (y < height) do
|
||||
begin
|
||||
Data.Read(pixelData, SizeOf(Byte));
|
||||
if (Data.Read(pixelData, SizeOf(Byte)) < SizeOf(Byte)) or
|
||||
(pixelData and $7F = 0) then
|
||||
begin
|
||||
x := width;
|
||||
y := height;
|
||||
Break;
|
||||
end;
|
||||
if (pixelData and $80) = $80 then color := clBlack else color := clWhite;
|
||||
for run := 1 to (pixelData and $7F) do
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user