Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95753c6

Browse filesBrowse files
committed
BUG: Ensure lib._format_impl.read_array handles file reading errors.
1 parent 991ec84 commit 95753c6
Copy full SHA for 95753c6

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎numpy/lib/_format_impl.py

Copy file name to clipboardExpand all lines: numpy/lib/_format_impl.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,9 @@ def read_array(fp, allow_pickle=False, pickle_kwargs=None, *,
872872
data = _read_bytes(fp, read_size, "array data")
873873
array[i:i + read_count] = numpy.frombuffer(data, dtype=dtype,
874874
count=read_count)
875+
876+
if array.size != count:
877+
raise IOError("Failed to read all data for array")
875878

876879
if fortran_order:
877880
array.shape = shape[::-1]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.