This is an automated email from the ASF dual-hosted git repository.
baunsgaard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new 4afd7f1 [SYSTEMDS-3219] Index out of bounds read of list
4afd7f1 is described below
commit 4afd7f1b3fb000f87949ec39a804fecfb1532c33
Author: baunsgaard <[email protected]>
AuthorDate: Mon Nov 15 18:13:57 2021 +0100
[SYSTEMDS-3219] Index out of bounds read of list
The recent addition of reading lists exposed an error while counting
the nnz in our ReaderTextCellParallel while reading in a list of matrices.
where some of them are empty matrices.
This commit fixes this by checking the index while reading.
This is not an ideal fix, since normal reading of the text file never ends
up with this error, indicating that there is some difference in the way
we process IO of lists vs individual files.
---
.../java/org/apache/sysds/runtime/io/ReaderTextCellParallel.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/src/main/java/org/apache/sysds/runtime/io/ReaderTextCellParallel.java
b/src/main/java/org/apache/sysds/runtime/io/ReaderTextCellParallel.java
index 9c1bc5c..e34d96a 100644
--- a/src/main/java/org/apache/sysds/runtime/io/ReaderTextCellParallel.java
+++ b/src/main/java/org/apache/sysds/runtime/io/ReaderTextCellParallel.java
@@ -264,9 +264,12 @@ public class ReaderTextCellParallel extends ReaderTextCell
if( value.toString().charAt(0) == '%' )
continue;
st.reset( value.toString() );
- _rNnz[(int)st.nextLong()-1] ++;
- if( _isSymmetric )
- _rNnz[(int)st.nextLong()-1] ++;
+ int nv = (int)st.nextLong()-1;
+ if(nv >= 0){
+ _rNnz[nv] ++;
+ if( _isSymmetric )
+
_rNnz[(int)st.nextLong()-1] ++;
+ }
}
}
finally {