From abf67489f1b8a4907cb213748947a4c30df2f1ec Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Tue, 14 Jun 2022 17:04:39 -0500 Subject: [PATCH] copy for newImage --- src/pixie/fileformats/gif.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pixie/fileformats/gif.nim b/src/pixie/fileformats/gif.nim index 80a65ad..b774d2e 100644 --- a/src/pixie/fileformats/gif.nim +++ b/src/pixie/fileformats/gif.nim @@ -105,6 +105,9 @@ proc decodeGif*(data: string): Gif {.raises: [PixieError].} = pos += 9 + if pos + localColorTableSize * 3 > data.len: + failInvalid() + var localColorTable: seq[ColorRGBX] if hasLocalColorTable: localColorTable.setLen(localColorTableSize) @@ -384,7 +387,7 @@ proc decodeGifDimensions*( result.height = data.readInt16(8).int proc newImage*(gif: Gif): Image {.raises: [].} = - gif.frames[0] + gif.frames[0].copy() when defined(release): {.pop.}