Merge pull request #10 from jangko/bug9

fixes #9
This commit is contained in:
andri lim 2017-07-17 17:18:52 +07:00 committed by GitHub
commit a961150d81
3 changed files with 4 additions and 1 deletions

View File

@ -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)

BIN
tester/sample.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

3
tester/test.nim Normal file
View File

@ -0,0 +1,3 @@
import nimPNG
let data = loadPNG32("sample.png")
assert(not data.isNil)