| Previous | Next |
| ERROR_DIRECT_ACCESS_HANDLE | ERROR_SEEK_ON_DEVICE |
ERROR_NEGATIVE_SEEK
The requested file position is negative
ERROR_NEGATIVE_SEEK is returned when file-position arithmetic produces an offset before byte zero. This often comes from signed underflow, subtracting a header size from a small position, or using the wrong seek origin.
Checks
- Log the current position, displacement, and seek origin.
- Validate subtraction before performing it.
- Use signed 64-bit arithmetic consistently for offsets.
- Check conversions from unsigned sizes to signed positions.
Fix
Reject or clamp invalid positions according to the file-format contract. Do not continue I/O as though the seek succeeded.
References
Looking for a different code? Search another status or error code.