Skip to content
OpenAdvisories

Weakness (CWE)

CWE-1335: Incorrect Bitwise Shift of Integer

Base Draft

An integer value is specified to be shifted by a negative amount or an amount greater than or equal to the number of bits contained in the value.

More detail

Specifying a value to be shifted by a negative amount is undefined in various languages. Various computer architectures implement this action in different ways. The compilers and interpreters when generating code to accomplish a shift generally do not do a check for this issue.

Specifying an over-shift - a shift greater than or equal to the number of bits contained in a value to be shifted - produces a result that varies by architecture and compiler. In some languages, this action is undefined.

How to prevent it (1 mitigation)
  1. Implementation

    Implicitly or explicitly add checks and mitigation for negative or over-shift values.

Source: MITRE CWE-1335

4 results · Clear filters · Feed

  • High 8.7

    Apache Thrift: C++ `THeaderTransport::writeVarint32()` stack buffer overflow on a negative protocol id

    Stack-based buffer overflow, Incorrect bitwise shift of integer vulnerability in Apache Thrift C++ THeaderProtocol. This issue affects Apache Thrift: before 0.25.0. Users are recommended to upgrade to version 0.25.0, which fixes the issue.

  • High 7.5

    nDPI 5.1.0 contains a memory access issue in the DNS dissector and serializer deserialization code. Specially crafted n…

  • High 7.8

    fs/jfs: Add check for negative db_l2nbperpage

    In the Linux kernel, the following vulnerability has been resolved: fs/jfs: Add check for negative db_l2nbperpage l2nbperpage is log2(number of blks per page), and the minimum legal value should be 0, not negative. In the case of l2nbperpage being negative, a…

  • High 8.8

    The inflateMark function in inflate.c in zlib 1.2.8 might allow context-dependent attackers to have unspecified impact …