diff --git a/private/nimz.nim b/private/nimz.nim index e8ab06a..5cf04b9 100644 --- a/private/nimz.nim +++ b/private/nimz.nim @@ -410,7 +410,7 @@ proc readInt16(s: var BitStream): int = #go to first boundary of byte while (s.bitpointer and 0x7) != 0: inc s.bitpointer var p = s.bitpointer div 8 #byte position - if p + 2 >= s.data.len: raise newNZError("bit pointer will jump past memory") + if p + 2 > s.data.len: raise newNZError("bit pointer will jump past memory") result = ord(s.data[p]) + 256 * ord(s.data[p + 1]) inc(s.bitpointer, 16) diff --git a/tester/sample.png b/tester/sample.png new file mode 100644 index 0000000..709d8b0 Binary files /dev/null and b/tester/sample.png differ diff --git a/tester/test.nim b/tester/test.nim new file mode 100644 index 0000000..c228b51 --- /dev/null +++ b/tester/test.nim @@ -0,0 +1,3 @@ +import nimPNG +let data = loadPNG32("sample.png") +assert(not data.isNil) \ No newline at end of file