Added better protection against internal leb128 underflow
There have already been a number of bugs that end up writing -1 out as leb128s. The current encoder doesn't know the different betwee -1 and 0xffffffff, so asserting before this situation can happen is quite important for preventing these bad leb128s from ever making it into a stable version. Also dropped LFS_ERR_OVERFLOW to use LFS_ERR_CORRUPT for bad leb128 encodings. These end up meaning the same thing to higher layers anyways.
This commit is contained in:
@@ -88,8 +88,6 @@ enum lfs_error {
|
||||
LFS_ERR_NOATTR = -61, // No data/attr available
|
||||
LFS_ERR_NAMETOOLONG = -36, // File name too long
|
||||
LFS_ERR_RANGE = -34, // Result out of range
|
||||
// TODO should all overflow errors actually be corrupt errors?
|
||||
LFS_ERR_OVERFLOW = -75, // Value too large for defined data type
|
||||
};
|
||||
|
||||
// File types
|
||||
|
||||
Reference in New Issue
Block a user