mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
FileAccessMemory: prevent seeking past end of file
This commit is contained in:
parent
36b92128b1
commit
3fa73d4f5f
1 changed files with 3 additions and 1 deletions
|
|
@ -98,12 +98,14 @@ bool FileAccessMemory::is_open() const {
|
|||
|
||||
void FileAccessMemory::seek(uint64_t p_position) {
|
||||
ERR_FAIL_NULL(data);
|
||||
ERR_FAIL_COND(p_position > length);
|
||||
pos = p_position;
|
||||
}
|
||||
|
||||
void FileAccessMemory::seek_end(int64_t p_position) {
|
||||
ERR_FAIL_NULL(data);
|
||||
pos = length + p_position;
|
||||
ERR_FAIL_COND((int64_t)length + p_position < 0);
|
||||
seek(length + p_position);
|
||||
}
|
||||
|
||||
uint64_t FileAccessMemory::get_position() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue