Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2020-11-01 13:23:47 +0000
committerMickael Istria2021-03-26 12:17:17 +0000
commit36bd6d71cd035cb981ed18c0aa9b42af05205bcb (patch)
treea9773f58e956092a62b917f6e9c75e2c9fc215d1
parentaea0f7e10bad34f5129dd2a9b373ef52b84a1c31 (diff)
downloadrt.equinox.p2-36bd6d71cd035cb981ed18c0aa9b42af05205bcb.tar.gz
rt.equinox.p2-36bd6d71cd035cb981ed18c0aa9b42af05205bcb.tar.xz
rt.equinox.p2-36bd6d71cd035cb981ed18c0aa9b42af05205bcb.zip
Bug: 32 bit int shifted by 32 bits in
org.eclipse.pde.internal.swt.tools.IconExe.read8(RandomAccessFile) The code performs shift of a 32 bit int by a constant amount outside the range -31..31. The effect of this is to use the lower 5 bits of the integer value to decide how much to shift by (e.g., shifting by 40 bits is the same as shifting by 8 bits, and shifting by 32 bits is the same as shifting by zero bits). This probably isn't what was expected, and it is at least confusing. Rank: Scariest (1), confidence: High Pattern: ICAST_BAD_SHIFT_AMOUNT Type: BSHIFT, Category: CORRECTNESS (Correctness) Change-Id: I8a50ebdc0171938901bd125e0733422d1c6593a6 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java
index 64d908d60..3e8a3d910 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java
@@ -748,14 +748,14 @@ public class IconExe {
}
static long read8(RandomAccessFile raf) throws IOException {
- int b0 = raf.readByte() & 0xFF;
- int b1 = raf.readByte() & 0xFF;
- int b2 = raf.readByte() & 0xFF;
- int b3 = raf.readByte() & 0xFF;
- int b4 = raf.readByte() & 0xFF;
- int b5 = raf.readByte() & 0xFF;
- int b6 = raf.readByte() & 0xFF;
- int b7 = raf.readByte() & 0xFF;
+ long b0 = raf.readByte() & 0xFF;
+ long b1 = raf.readByte() & 0xFF;
+ long b2 = raf.readByte() & 0xFF;
+ long b3 = raf.readByte() & 0xFF;
+ long b4 = raf.readByte() & 0xFF;
+ long b5 = raf.readByte() & 0xFF;
+ long b6 = raf.readByte() & 0xFF;
+ long b7 = raf.readByte() & 0xFF;
return b7 << 56 | b6 << 48 | b5 << 40 | b4 << 32 | b3 << 24 | b2 << 16 | b1 << 8 | b0;
}

Back to the top