Skip to content

Commit 05e4e54

Browse files
committed
BinaryWriter: fix int32 overflow causing data loss in .npy files
* .npy files >2 GiB would overwrite themselves
1 parent 30f9d33 commit 05e4e54

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Source/Plugins/BinaryWriter/NpyFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void NpyFile::updateHeader()
159159
// overwrite the shape part of the header - even without explicitly calling
160160
// m_file->flush(), overwriting seems to trigger a flush to disk,
161161
// while appending to end of file does not
162-
int currentPos = m_file->getPosition();
162+
int64 currentPos = m_file->getPosition(); // returns int64, necessary for big files
163163
if (m_file->setPosition(m_shapePos))
164164
{
165165
String newShape = getShapeString();

0 commit comments

Comments
 (0)