Skip to content

Commit 9486f13

Browse files
committed
fixed 32bit integer overflow
1 parent fb4ca80 commit 9486f13

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/stdlib_io_npy_load.fypp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ contains
136136
header_len = ichar(buf(1)) &
137137
& + ichar(buf(2)) * 2**8 &
138138
& + ichar(buf(3)) * 2**16 &
139-
& + ichar(buf(4)) * 2**32
139+
& + ichar(buf(4)) * 2**24
140140
else
141141
header_len = ichar(buf(1)) &
142142
& + ichar(buf(2)) * 2**8

src/stdlib_io_npy_save.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ contains
6262

6363
str = achar(mod(val, 2**8)) // &
6464
& achar(mod(val, 2**16) / 2**8) // &
65-
& achar(mod(val, 2**32) / 2**16) // &
66-
& achar(val / 2**32)
65+
& achar(mod(val, 2**24) / 2**16) // &
66+
& achar(val / 2**24)
6767
end function to_bytes_i4
6868

6969

0 commit comments

Comments
 (0)