SCM

[#6745] show(sparseVector) throws error for lengths above INT_MAX

Date:
2021-10-14 02:07
Priority:
3
State:
Closed
Submitted by:
David Cortes (david.cortes)
Assigned to:
Martin Maechler (mmaechler)
Hardware:
None
Product:
None
Operating System:
None
Component:
None
Version:
None
Severity:
None
Resolution:
Fixed
URL:
Summary:
show(sparseVector) throws error for lengths above INT_MAX

Detailed description
If I try to call 'show' on a 'sparseVector' whose length is larger than 'INT_MAX', it will throw an error:

library(Matrix)
svec = new("dsparseVector", length=2^33, i=numeric(), x=numeric())
show(svec)

Result:
sparse vector (nnz/length = 0/8589934592) of class "dsparseVector"
Error in seq_len(which.max(x@i > n) - 1L) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(which.max(x@i > n) - 1L) :
first element used of 'length.out' argument

Comments:

Message  ↓
Date: 2021-10-14 08:07
Sender: Martin Maechler

Committed to the R-forge source now, together with another bug in *indexing* such large sparseVectors -- all in svn r3408.

Date: 2021-10-14 06:57
Sender: Martin Maechler

Thank you, David!
Note:
- this only happens for a completely empty sparse vector, i.e., when `x@i` has length zero
- the bug is in the head() method

Attached Files:

Changes

Field Old Value Date By
status_idOpen2021-10-14 08:08mmaechler
close_dateNone2021-10-14 08:08mmaechler
ResolutionAccepted As Bug2021-10-14 08:07mmaechler
ResolutionNone2021-10-14 06:57mmaechler
assigned_tonone2021-10-14 06:57mmaechler
Thanks to:
Vienna University of Economics and Business Powered By FusionForge