EOVERFLOW
Linux / POSIXERRORNotableFilesystemHIGH confidence

Value Too Large for Defined Data Type

Production Risk

Common issue when 32-bit code encounters files larger than 2GB; always compile with LFS support.

What this means

EOVERFLOW (errno 75) is returned when a value is too large to be stored in the data type used to receive it. Most commonly occurs with file sizes or offsets that exceed what a 32-bit type can hold on a 32-bit system.

Why it happens
  1. 1stat() on a file larger than 2GB on a 32-bit process without _FILE_OFFSET_BITS=64
  2. 2read() or lseek() with an offset beyond 32-bit range on a 32-bit binary
  3. 3st_size field overflow in struct stat on large files
How to reproduce

stat() on a large file from a 32-bit binary.

trigger — this will error
trigger — this will error
// 32-bit binary, file > 2GB
struct stat st;
stat("/data/largefile.img", &st);
// Returns -1, errno = EOVERFLOW

expected output

stat: Value too large for defined data type (EOVERFLOW)

Fix 1

Compile with large file support

WHEN When accessing files larger than 2GB from 32-bit code

Compile with large file support
// Add to compilation flags:
// -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
// Or use 64-bit variants explicitly:
struct stat64 st;
stat64("/data/largefile.img", &st);

Why this works

_FILE_OFFSET_BITS=64 remaps stat/off_t to 64-bit variants transparently.

Fix 2

Build as a 64-bit binary

WHEN For new code on 64-bit systems

Build as a 64-bit binary
# Compile as 64-bit (default on x86_64)
gcc -m64 -o myprogram myprogram.c

Why this works

64-bit binaries use 64-bit off_t natively, avoiding EOVERFLOW entirely.

What not to do

Ignore EOVERFLOW and use the returned value anyway

The value is truncated and incorrect; using it leads to data corruption or incorrect behavior.

Sources

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors