HaxeFoundation / HaxeFoundation/hxcpp

FileStat size integer overflow

Open
#705 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

`sys.FileSystem.stat(path).size` returns a negative number for a file more than 2.1 GB long

The problem is all values from `stat` are cast to 4 byte int:
`STATF(size);` [Sys.cpp#L410](https://github.com/HaxeFoundation/hxcpp/blob/master/src/hx/libs/std/Sys.cpp#L410)
`#define STATF(f) o->Add(HX_CSTRING(#f),(int)(s.st_##f))` [Sys.cpp#L369](https://github.com/HaxeFoundation/hxcpp/blob/master/src/hx/libs/std/Sys.cpp#L369)

(also mode is set twice)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.