diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-05 22:16:01 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-05 22:16:01 +0200 |
commit | d8b3680268a4390891e74f0b7b58d8cddabcd0b0 (patch) | |
tree | a51f2819eaaa8dbfb7e92742bea99bce97bccdee /src/img | |
parent | 2307d2ad0a9f89cf625fbad2bbf6d5a81d62d812 (diff) | |
download | chawan-d8b3680268a4390891e74f0b7b58d8cddabcd0b0.tar.gz |
Fix stupid overflow
Diffstat (limited to 'src/img')
-rw-r--r-- | src/img/bitmap.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/img/bitmap.nim b/src/img/bitmap.nim index f944ad59..7c694370 100644 --- a/src/img/bitmap.nim +++ b/src/img/bitmap.nim @@ -175,7 +175,7 @@ type PNGWriter = object outlen: int func pngInt(i: uint32): auto = - doAssert i < uint32(2 ^ 31) + doAssert i < uint32(2) ^ 31 return i.toBytesBE() func oq(writer: PNGWriter): ptr UncheckedArray[uint8] = @@ -192,7 +192,7 @@ proc writeInt(writer: var PNGWriter, i: uint32) = writer.writeStr(i.toBytesBE()) proc writePngInt(writer: var PNGWriter, i: uint32) = - doAssert i < uint32(2 ^ 31) + doAssert i < uint32(2) ^ 31 writer.writeInt(i) proc writeChunk[T](writer: var PNGWriter, t: string, data: T) = @@ -334,7 +334,7 @@ template readU32(reader: var PNGReader): uint32 = template readPNGInt(reader: var PNGReader): uint32 = let x = reader.readU32() - if x >= uint32(2 ^ 31): + if x >= uint32(2) ^ 31: reader.err "int too large" x |