mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
Kernel: Handle overflow in FileDescription::seek(, SEEK_CUR)
This commit is contained in:
parent
26bba8e100
commit
2139e0a201
Notes:
sideshowbarker
2024-07-18 22:03:05 +09:00
Author: https://github.com/bgianfo
Commit: 2139e0a201
Pull-request: https://github.com/SerenityOS/serenity/pull/5454
1 changed files with 2 additions and 0 deletions
|
@ -138,6 +138,8 @@ off_t FileDescription::seek(off_t offset, int whence)
|
|||
new_offset = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
if (Checked<off_t>::addition_would_overflow(m_current_offset, offset))
|
||||
return -EOVERFLOW;
|
||||
new_offset = m_current_offset + offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue