Explorar o código

TmpFS: Add ASSERT(offset >= 0) to read_bytes() and write_bytes()

Andreas Kling %!s(int64=5) %!d(string=hai) anos
pai
achega
a49d9c774f
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      Kernel/FileSystem/TmpFS.cpp

+ 2 - 0
Kernel/FileSystem/TmpFS.cpp

@@ -155,6 +155,7 @@ ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, u8* buffer, FileDescr
     LOCKER(m_lock);
     ASSERT(!is_directory());
     ASSERT(size >= 0);
+    ASSERT(offset >= 0);
 
     if (!m_content.has_value())
         return 0;
@@ -170,6 +171,7 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const u8* buffer, Fi
 {
     LOCKER(m_lock);
     ASSERT(!is_directory());
+    ASSERT(offset >= 0);
 
     off_t old_size = m_metadata.size;
     off_t new_size = m_metadata.size;