浏览代码

LibGfx/ICC: Avoid overflow when checking tag bounds

Tim Ledbetter 1 年之前
父节点
当前提交
c21efdfc8a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibGfx/ICC/Profile.cpp

+ 1 - 1
Userland/Libraries/LibGfx/ICC/Profile.cpp

@@ -560,7 +560,7 @@ static ErrorOr<NonnullRefPtr<TagData>> read_tag(ReadonlyBytes bytes, u32 offset_
     if (offset_to_beginning_of_tag_data_element % 4 != 0)
         return Error::from_string_literal("ICC::Profile: Tag data not aligned");
 
-    if (offset_to_beginning_of_tag_data_element + size_of_tag_data_element > bytes.size())
+    if (static_cast<u64>(offset_to_beginning_of_tag_data_element) + size_of_tag_data_element > bytes.size())
         return Error::from_string_literal("ICC::Profile: Tag data out of bounds");
 
     auto tag_bytes = bytes.slice(offset_to_beginning_of_tag_data_element, size_of_tag_data_element);