[haiku-commits] Change in haiku[master]: RAWTranslator: fix integer overflow

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 23 Mar 2020 01:10:38 +0000

From X512 <danger_mail@xxxxxxx>:

X512 has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2406 ;)


Change subject: RAWTranslator: fix integer overflow
......................................................................

RAWTranslator: fix integer overflow

Pointed by clang.

Change-Id: I6e2c62ccfa7bec381a02b08d54c7469bbb8d7a67
---
M src/add-ons/translators/raw/RAW.cpp
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/06/2406/1

diff --git a/src/add-ons/translators/raw/RAW.cpp 
b/src/add-ons/translators/raw/RAW.cpp
index 6fd6e8b..b68aa5f 100644
--- a/src/add-ons/translators/raw/RAW.cpp
+++ b/src/add-ons/translators/raw/RAW.cpp
@@ -619,10 +619,11 @@
                        int32 i = 0;

                        for (; offset + 22 < tag.length; offset += 22 + i) {
-                               tag.tag = fRead.Next<uint32>();
+                               uint32 tag32 = fRead.Next<uint32>();
+                               tag.tag = (uint16)tag32;
                                fRead.Seek(14, SEEK_CUR);
                                i = fRead.Next<uint32>() - 4;
-                               if (tag.tag == 0x76a43207)
+                               if (tag32 == 0x76a43207)
                                        fMeta.flip = fRead.Next<uint16>();
                                else
                                        fRead.Seek(i, SEEK_CUR);

--
To view, visit https://review.haiku-os.org/c/haiku/+/2406
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I6e2c62ccfa7bec381a02b08d54c7469bbb8d7a67
Gerrit-Change-Number: 2406
Gerrit-PatchSet: 1
Gerrit-Owner: X512 <danger_mail@xxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: RAWTranslator: fix integer overflow - Gerrit