To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Examples of errors detected by the V610…

Examples of errors detected by the V610 diagnostic

V610. Undefined behavior. Check the shift operator.


lib7z

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('(8 * i)' = [0..56]) is greater than or equal to the length in bits of the promoted left operand. lib7z 7zin.c 233


SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream,
                               UInt64 *value)
{
  int i;
  *value = 0;
  for (i = 0; i < 8; i++)
  {
    Byte b;
    RINOK(SafeReadDirectByte(inStream, &b));
    *value |= ((UInt32)b << (8 * i));
  }
  return SZ_OK;
}

Game_Music_Emu library

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0x2F00' is negative. game-music-emu spc_cpu.cpp 437


void Snes_Spc::cpu_write(....)
{
  ....
  if ( ((~0x2F00 << (bits_in_int - 16)) << reg) < 0 ) // 36%
  ....
}

FAAC

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. libfaac bitstream1.c 796


static int WriteTNSData(....)
{
  ....
  unsignedIndex = (unsigned long) (
    tnsFilterPtr->index[i])&(~(~0<<bitsToTransmit));
  ....
}

Blender

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(- 1)' is negative. bf_editor_space_view3d view3d_draw.c 101


#define cpack(x) glColor3ub( ((x)&0xFF), (((x)>>8)&0xFF), \
(((x)>>16)&0xFF) )

static void star_stuff_init_func(void)
{
  cpack(-1);
  glPointSize(1.0);
  glBegin(GL_POINTS);
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. bf_intern_ghost ghost_ndofmanager.cpp 289
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. extern_bullet btquantizedbvh.h 82
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. extern_bullet btsoftbodyconcavecollisionalgorithm.h 48

UCSniff

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~1' is negative. ec_ip.c 187


#define FP_HOST_NONLOCAL   1<<1

FUNC_DECODER(decode_ip)
{
  ....
  PACKET->PASSIVE.flags &= ~FP_HOST_NONLOCAL;
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~1' is negative. ec_ip6.c 110

DeSmuME

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. DeSmuME_VS2005 mmu_timing.h 158


enum { TAGMASK = (u32)(~0 << TAGSHIFT) };

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. DeSmuME_VS2005 cheatsystem.cpp 1335
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. DeSmuME_VS2005 gfx3d.cpp 811
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(SBits) - 8' is negative. DeSmuME_VS2005 lua-engine.cpp 1345
  • And 2 additional diagnostic messages.

MAME

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. atarig42.c 220


#define ATARIRLE_PRIORITY_SHIFT  12
#define ATARIRLE_PRIORITY_MASK \
  ((~0 << ATARIRLE_PRIORITY_SHIFT) & 0xffff)

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..43]) is greater than or equal to the length in bits of the promoted left operand. firetrk.c 113
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. atarigx2.c 214
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. atarisy1.c 524
  • And 47 additional diagnostic messages.

MAME

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..43]) is greater than or equal to the length in bits of the promoted left operand. firetrk.c 111


UINT32 m_color1_mask;
UINT32 m_color2_mask;

#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))

PALETTE_INIT( montecar )
{
 static const UINT8 colortable_source[] =
 {
  0x00, 0x00, 0x00, 0x01,
  0x00, 0x02, 0x00, 0x03,
  0x03, 0x03, 0x03, 0x02,
  0x03, 0x01, 0x03, 0x00,
  0x00, 0x00, 0x02, 0x00,
  0x02, 0x01, 0x02, 0x02,
  0x00, 0x10, 0x20, 0x30,
  0x00, 0x04, 0x08, 0x0c,
  0x00, 0x44, 0x48, 0x4c,
  0x00, 0x84, 0x88, 0x8c,
  0x00, 0xc4, 0xc8, 0xcc
 };
  ....
 for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
 {
  UINT8 color = colortable_source[i];

  if (color == 1)
   state->m_color1_mask |= 1 << i;                  // <=
  else if (color == 2)
   state->m_color2_mask |= 1 << i;                  // <=

  prom_to_palette(machine, i,
    color_prom[0x100 + colortable_source[i]]);
 }
  ....
}

LLVM/Clang

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. bitvector.h 175


int find_next(unsigned Prev) const {
  ....
  // Mask off previous bits.
  Copy &= ~0L << BitPos;
  ....
}

LLVM/Clang

V610 Undefined behavior. Check the shift operator '<<=. The left operand 'Val' is negative. pointerintpair.h 139


static Ty getEmptyKey() {
  intptr_t Val = -1;
  Val <<= PointerLikeTypeTraits<PointerTy>::NumLowBitsAvailable;
  return Ty(reinterpret_cast<PointerTy>(Val),
            IntType((1 << IntBits)-1));
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. bitvector.h 454
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. sparsebitvector.h 161
  • V610 Undefined behavior. Check the shift operator '<<=. The left operand 'Val' is negative. pointerintpair.h 144
  • And 2 additional diagnostic messages.

Samba

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. idtree.c 284


static void *_idr_find(struct idr_context *idp, int id)
{
  ....
  if (n + IDR_BITS < 31 &&
      ((id & ~(~0 << MAX_ID_SHIFT)) >> (n + IDR_BITS))) {
    return NULL;
  }
  ....
}

OpenCV

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(- 2147483647 - 1)' is negative. contours.cpp 1012


CvSeq * cvFindNextContour( CvContourScanner scanner )
{
  ....
  new_mask = INT_MIN >> 1;
  ....
}

ReactOS

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-16' is negative. vl_mpeg12_bitstream.c 653


static INLINE int
wrap(short f, int shift)
{
  ....
  if (f < (-16 << shift))
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. jdarith.c 460
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. jdhuff.c 930
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. layer1.c 86
  • And 6 additional diagnostic messages.

Skia Graphics Engine

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-2' is negative. skfixed.h 88


inline SkFract SkFixedToFract(SkFixed x)
{
  SkASSERT(x >= (-2 << 16) && x <= (2 << 16) - 1);
  return x << 14;
}

WebP

V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('(89858 * (i - 128) + YUV_HALF)' = [-11469056..11444734]). yuv.c 40


void VP8YUVInit(void) {
  ....
  for (i = 0; i < 256; ++i) {
    VP8kVToR[i] = (89858 * (i - 128) + YUV_HALF) >> YUV_FIX;
    VP8kUToG[i] = -22014 * (i - 128) + YUV_HALF;
    VP8kVToG[i] = -45773 * (i - 128);
    VP8kUToB[i] = (113618 * (i - 128) + YUV_HALF) >> YUV_FIX;
  }
  ....
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('(113618 * (i - 128) + YUV_HALF)' = [-14510336..14462254]). yuv.c 43
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('((i - 16) * 76283 + YUV_HALF)' = [-18504001..35504363]). yuv.c 46

Chromium

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. webm_cluster_parser.cc 217


bool WebMClusterParser::ParseBlock(....)
{
  int timecode = buf[1] << 8 | buf[2];
  ....
  if (timecode & 0x8000)
    timecode |= (-1 << 16);
  ....
}

Mesa 3D Graphics Library

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..47]) is greater than or equal to the length in bits of the promoted left operand. s_span.c 768


#define MAX_VARYING 32

typedef enum
{
  ....
  FRAG_ATTRIB_VAR0 = 16,
  FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
} gl_frag_attrib;

static inline GLuint
clip_span( struct gl_context *ctx, SWspan *span )
{
  ....
  for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
    if (span->interpMask & (1 << i)) {
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..47]) is greater than or equal to the length in bits of the promoted left operand. s_span.c 789

WebRTC

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..63]) is greater than or equal to the length in bits of the promoted left operand. rtcp_sender.cc 1105


int32_t
RTCPSender::BuildREMB(uint8_t* rtcpbuffer, uint32_t& pos)
{
  ....
  for(uint32_t i=0; i<64; i++)
  {
    if(_rembBitrate <= ((uint32_t)262143 << i))
    {
      brExp = i;
      break;
    }
  }
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..63]) is greater than or equal to the length in bits of the promoted left operand. rtcp_sender.cc 1222
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [0..63]) is greater than or equal to the length in bits of the promoted left operand. rtcp_sender.cc 1288

Skia Graphics Engine

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. skedge.cpp 414


int SkCubicEdge::setCubic(const SkPoint pts[4],
                          const SkIRect* clip, int shift)
{
  ....
  fCurveCount = SkToS8(-1 << shift);
  ....
}

Skia Graphics Engine

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-0xFFFF' is negative. skradialgradient.cpp 82


void shadeSpan16_radial_clamp(....) {
  ....
  fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
  ....
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-0xFFFF' is negative. skradialgradient.cpp 85
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-0xFFFF' is negative. skradialgradient.cpp 95
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-0xFFFF' is negative. skradialgradient.cpp 96
  • And 4 additional diagnostic messages.

usrsctp

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. sctp_output.c 10898


void
sctp_send_sack(struct sctp_tcb *stcb, int so_locked)
{
  ....
  tsn_map &= (~0 << (1 - offset));
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. sctp_output.c 10972
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. bitvect.c 404
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. bitvect.c 759
  • And 14 additional diagnostic messages.

Snes9x

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. sar.h 217


static inline int64 SAR (const int64 b, const int n)
{
#ifndef RIGHTSHIFT_int64_IS_SAR
  if (b < 0)
    return ((b >> n) | (-1 << (64 - n)));
#endif
  return (b >> n);
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(SBits) - 8' is negative. lua-engine.cpp 1296
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(SBits) - 8' is negative. lua-engine.cpp 1306
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand is negative ('x2' = [-1..3]). lua-engine.cpp 3284

Snes9x

V610 Unspecified behavior. Check the shift operator '>>=. The left operand 'C' is negative. dsp1.cpp 808


static void DSP1_Parameter (....)
{
  int16  C;
  ....
  if (C == -32768)
  {
    C >>= 1;
    E++;
  }
  ....
}

VirtualDub

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. VirtualDub avioutputgif.cpp 702


void AVIVideoGIFOutputStream::write(....) {
{
  ....
  for(int i=0; i<palsize; ++i)
    dict[i].mPrevAndLastChar = (-1 << 16) + i;
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-0x0100' is negative. VirtualDub audiosource.cpp 602
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-0x0200' is negative. VirtualDub audiosource.cpp 603
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-0x0300' is negative. VirtualDub audiosource.cpp 604
  • And 16 additional diagnostic messages.

speex

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. bits.c 278


EXPORT int speex_bits_unpack_signed(SpeexBits *bits,
                                    int nbBits)
{
   unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
   /* If number is negative */
   if (d>>(nbBits-1))
   {
      d |= (-1)<<nbBits;
   }
   return d;
}

PostgreSQL Database Management System

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. postgres inet_cidr_ntop.c 206


static char *
inet_cidr_ntop_ipv6(const u_char *src, int bits,
                    char *dst, size_t size)
{
  ....
  m = ~0 << (8 - b);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '((int64) - 1)' is negative. postgres network.c 1435
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand is negative ('((i) - 1)' = [-1..30]). postgres signal.c 118
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand is negative ('((i) - 1)' = [-1..30]). postgres signal.c 125
  • And 2 additional diagnostic messages.

Source Engine SDK

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0x03' is negative. Client (HL2) c_func_breakablesurf.cpp 157


inline void SetStyleType( int w, int h, int type )
{
  Assert( type < NUM_EDGE_STYLES );
  Assert( type >= 0 );
  // Clear old value
  m_nPanelBits[ w ][ h ] &= ( ~0x03 << 2 );
  // Insert new value
  m_nPanelBits[ w ][ h ] |= ( type << 2 );
}

LibRaw

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. dcraw_common.cpp 1827


unsigned CLASS pana_bits (int nbits)
{
  ....
  return (buf[byte] | buf[byte+1] << 8) >>
         (vbits & 7) & ~(-1 << nbits);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. dcraw_common.cpp 1851
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. dcraw_common.cpp 2085
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. dcraw_common.cpp 2814
  • And 1 additional diagnostic messages.

GNU C Library

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '~0xff' is negative. strxfrm_l.c 68


utf8_encode (char *buf, int val)
{
  ....
  *buf = (unsigned char) (~0xff >> step);
  ....
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '~0xff' is negative. loop.c 331
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '~0xff' is negative. loop.c 437
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-1' is negative. mktime.c 207
  • And 19 additional diagnostic messages.

GNU C Library

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. cacheinfo.c 645


static void init_cacheinfo (void)
{
  ....
  count_mask = ~(-1 << (count_mask + 1));
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~(clockid_t)(0)' is negative. clock_nanosleep.c 38
  • V610 Undefined behavior. Check the shift operator '<<=. The left operand 'c' is negative. ifaddrs.c 786
  • V610 Undefined behavior. Check the shift operator '>>'. The right operand '32' is greater than or equal to the length in bits of the promoted left operand. xdr_intXX_t.c 35
  • And 8 additional diagnostic messages.

Firebird

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. ods.h 337


const ULONG END_BUCKET = (~0) << 1;

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('i64value' = [-2147483648..2147483647]). exprnodes.cpp 6185
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('literal' = [-32768..32767]). array.cpp 845

V8 JavaScript Engine

V610 Undefined behavior. Check the shift operator '>>'. The right operand 'shift_bits' is greater than or equal to the length in bits of the promoted left operand. v8.h 5343


template <> struct SmiTagging<8> {

  static const int kSmiShiftSize = 31;
  static const int kSmiValueSize = 32;

  V8_INLINE static int SmiToInt(internal::Object* value) {
    int shift_bits = kSmiTagSize + kSmiShiftSize;
    return static_cast<int>(reinterpret_cast<intptr_t>(value) >>
      shift_bits);
  }
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. objects.h 6433
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~kMaxCachedArrayIndexLength' is negative. objects.h 8624
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-8' is negative. test-utils.cc 55
  • And 4 additional diagnostic messages.

FlightGear

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0x01' is negative. standardmanipulator 185


inline void StandardManipulator::setRelativeFlag(
  int index, bool value )
{
  if( value )  _relativeFlags |= (0x01 << index);
  else  _relativeFlags &= (~0x01 << index);
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. bits.c 266
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-2560' is negative. short_term.c 68
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1792' is negative. short_term.c 71
  • And 5 additional diagnostic messages.

FFmpeg

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. diracdec.c 1358


static int mc_subpel(....)
{
  ....
  mx = motion_x & ~(-1 << s->mv_precision);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. apedec.c 1297
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. diracdec.c 1359
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. g723_1.c 2145
  • And 49 additional diagnostic messages.

Tesseract

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. libtesseract303 dawg.cpp 187


void Dawg::init(....)
{
  ....
  letter_mask_ = ~(~0 << flag_start_bit_);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. libtesseract303 dawg.cpp 188
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. libtesseract303 intmatcher.cpp 172
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. libtesseract303 intmatcher.cpp 174
  • And 17 additional diagnostic messages.

Newton Game Dynamics

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1LL)' is negative. dggoogol.cpp 249


dgGoogol dgGoogol::Floor () const
{
  ....
  dgUnsigned64 mask = (-1LL) << (64 - bits);
  ....
}

Most likely this is what should be written here: dgUnsigned64 mask = (~0LLU) << (64 - bits);


Wine Is Not an Emulator

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(LONGLONG) - 1' is negative. propvar.c 127


static HRESULT PROPVAR_ConvertNumber(....)
{
  ....
  if (*res >= ((LONGLONG)1 << (dest_bits-1)) ||
      *res < ((LONGLONG)-1 << (dest_bits-1)))
    return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
  ....
}

Grassroots DICOM library (GDCM)

V610 Unspecified behavior. Check the shift operator '>>'. The left operand 'nmask' is negative. gdcmimagecodec.cxx 397


bool ImageCodec::DoOverlayCleanup(....)
{
  ....
  // nmask : to propagate sign bit on negative values
  int16_t nmask = (int16_t)0x8000;
  nmask = nmask >>
          ( PF.GetBitsAllocated() - PF.GetBitsStored() - 1 );
  ....
}

HDF5

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. h5znbit.c 974


static void
H5Z_nbit_decompress_one_byte(....)
{
  data[data_offset + k] =
    ((val >> (*buf_len - dat_len)) & ~(~0 << dat_len)) <<
      uchar_offset;
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. h5znbit.c 978
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. h5znbit.c 985
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. h5znbit.c 1003
  • And 12 additional diagnostic messages.

Miranda NG

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. AdvaImg jdarith.c 460


METHODDEF(boolean)
decode_mcu_AC_refine (....)
{
  ....
  m1 = (-1) << cinfo->Al;
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. AdvaImg jdhuff.c 930
  • V610 Undefined behavior. Check the shift operator '>>'. The right operand ('(8 * x)' = [0..56]) is greater than or equal to the length in bits of the promoted left operand. Libgcrypt cipher.c 1529

Spring Engine

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. engine-dedicated%engine-headless%engine-legacy%unitsync cpuid.cpp 176


void CpuId::getMasksIntelLeaf11()
{
  getMasksIntelLeaf11Enumerate();

  // We determined the shifts now compute the masks
  maskVirtual = ~((-1) << shiftCore);
  maskCore = (~((-1) << shiftPackage)) ^ maskVirtual;
  maskPackage = (-1) << shiftPackage;
}

Linux Kernel

V610 Undefined behavior. Check the shift operator '<<. The left operand '-1' is negative. hid-core.c 1016


static s32 snto32(__u32 value, unsigned n)
{
  switch (n) {
  case 8:  return ((__s8)value);
  case 16: return ((__s16)value);
  case 32: return ((__s32)value);
  }
  return value & (1 << (n - 1)) ? value | (-1 << n) : value;
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '>>. The right operand ('(5 * i)' = [0..45]) is greater than or equal to the length in bits of the promoted left operand. ar9003_hw.c 1022
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~(1 << 1)' is negative. bnx2x_link.c 10910
  • V610 Undefined behavior. Check the shift operator '<<. The left operand '~0' is negative. tmscsim.c 1109
  • And 113 additional diagnostic messages.

LibreOffice

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~int (0))' is negative. grammar.hxx 56


static const int kConventionShift = 16;
static const int kFlagMask = ~((~int(0)) << kConventionShift);

.NET CoreCLR

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. bcltype metamodel.h 532


inline static mdToken decodeToken(....)
{
    //<TODO>@FUTURE: make compile-time calculation</TODO>
    ULONG32 ix = (ULONG32)(val & ~(-1 << m_cb[cTokens]));

    if (ix >= cTokens)
        return rTokens[0];
    return TokenFromRid(val >> m_cb[cTokens], rTokens[ix]);
}

.NET CoreCLR

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. cee_dac decodemd.cpp 456


#define bits_generation 2
#define generation_mask (~(~0 << bits_generation))

#define MASK(len) (~((~0)<<len))
#define MASK64(len) ((~((~((unsigned __int64)0))<<len)))

void Encoder::Add(unsigned value, unsigned length)
{
  ....
  value = (value & MASK(length));
  ....
}

SETI@home

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. analyzefuncs.cpp 177


int seti_analyze (ANALYSIS_STATE& state)
{
  ....
  int last_chirp_ind = - 1 << 20, chirprateind;
  ....
}

Apple II emulator

V610 Unspecified behavior. Check the shift operator '>>'. The left operand 'SPKR_DATA_INIT' is negative. speaker.cpp 450


const short SPKR_DATA_INIT = (short)0x8000;

BYTE __stdcall SpkrToggle (....)
{
  ....
  if (g_nSpeakerData == (SPKR_DATA_INIT >> 2))
  ....
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand 'SPKR_DATA_INIT' is negative. speaker.cpp 453
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '~0x180' is negative. tfe.cpp 869
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '~0x100' is negative. tfe.cpp 987

Mozilla Thunderbird

V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. nsprotocolproxyservice.cpp 336


static void
proxy_MaskIPv6Addr(PRIPv6Addr &addr, uint16_t mask_len)
{
  ....
  addr.pr_s6_addr32[3] = PR_htonl(
    PR_ntohl(addr.pr_s6_addr32[3]) & (~0L << (128 - mask_len)));
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. nsprotocolproxyservice.cpp 341
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. nsprotocolproxyservice.cpp 347
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0L' is negative. nsprotocolproxyservice.cpp 354

OpenMW

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 127 - 1)' is negative. globalmap.cpp 176


void GlobalMap::render (Loading::Listener* loadingListener)
{
  ....
  y = (SCHAR_MIN << 4) / 2048.f;
  ....
}

ChakraCore

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. constants.h 39


class Constants
{
public:
  ....
  static const int Int31MinValue = -1 << 30;
  ....
};

Oracle VM Virtual Box

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 2)' is negative. translate.c 2708


static void gen_push_T1(DisasContext *s)
{
  ....
  if (s->ss32 && !s->addseg)
    gen_op_mov_reg_A0(1, R_ESP);
  else
    gen_stack_update(s, (-2) << s->dflag);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand is negative ('i64' = [-1..0]). tarvfs.cpp 234
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-16' is negative. translate.c 2761

Serious Engine 1 v.1.10

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 2)' is negative. layermaker.cpp 363


void CLayerMaker::SpreadShadowMaskOutwards(void)
{
  #define ADDNEIGHBOUR(du, dv)                                  \
  if ((pixLayerU+(du)>=0)                                       \
    &&(pixLayerU+(du)<pixLayerSizeU)                            \
    &&(pixLayerV+(dv)>=0)                                       \
    &&(pixLayerV+(dv)<pixLayerSizeV)                            \
    &&(pubPolygonMask[slOffsetMap+(du)+((dv)<<pixSizeULog2)])) {\
    ....                                                        \
    }

  ADDNEIGHBOUR(-2, -2); // <=
  ADDNEIGHBOUR(-1, -2); // <=
  ....                  // <=
}

Firebird

V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('literal' = [-32768..32767]). array.cpp 848


static ISC_STATUS stuff_literal(gen_t* gen, SLONG literal)
{
  ....
  if (literal >= -32768 && literal <= 32767)
    return stuff_args(gen, 3, isc_sdl_short_integer, literal,
                      literal >> 8);
  ....
}

Similar errors can be found in some other places:

  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('i64value' = [-2147483648..2147483647]). exprnodes.cpp 6382

OpenSSL

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(0xffffffffffffffffLL)' is negative. bn_lib.c 796


#define BN_MASK2 (0xffffffffffffffffLL)
int BN_mask_bits(BIGNUM *a, int n)
{
  ....
  a->d[w] &= ~(BN_MASK2 << b); // <=
  ....
}

CryEngine V

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. physicalplaceholder.h 25


#ifndef physicalplaceholder_h
#define physicalplaceholder_h
#pragma once
....
const int NO_GRID_REG = -1<<14;
const int GRID_REG_PENDING = NO_GRID_REG+1;
....

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~(TFragSeqStorage(0))' is negative. udpdatagramsocket.cpp 757
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. tetrlattice.cpp 324
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. tetrlattice.cpp 350
  • And 5 additional diagnostic messages.

Far2l

V610 Undefined behavior. Check the shift operator '<<'. The right operand 'sizeof (wchar_t) * 8' is greater than or equal to the length in bits of the promoted left operand. RegExp.cpp 4467


#define rechar wchar_t
#define RE_CHAR_COUNT (1 << sizeof(rechar) * 8)

int RegExp::Optimize()
{
  ....
  for (op=code; ; op=op->next)
  {
    switch (OP.op)
    {
    ....
    case opType:
    {
      for (int i = 0; i < RE_CHAR_COUNT; i++)    // <=
      {
        if (ISTYPE(i, OP.type))
        {
          first[i]=1;
        }
      }

      break;
    }
    }
    ....
  }
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The right operand 'sizeof (wchar_t) * 8' is greater than or equal to the length in bits of the promoted left operand. RegExp.cpp 4473
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand 'sizeof (wchar_t) * 8' is greater than or equal to the length in bits of the promoted left operand. RegExp.cpp 4490
  • V610 Undefined behavior. Check the shift operator '<<'. The right operand 'sizeof (wchar_t) * 8' is greater than or equal to the length in bits of the promoted left operand. RegExp.cpp 4537
  • And 2 additional diagnostic messages.

FreeBSD Kernel

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. pf_table.c 911


static void
pfr_prepare_network(union sockaddr_union *sa, int af, int net)
{
  ....
  sa->sin.sin_addr.s_addr = net ? htonl(-1 << (32-net)) : 0;
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. pf_table.c 918
  • V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(0x1 << 31)' is negative. qls_dump.c 589
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '~0' is negative. bhnd_pmu_subr.c 790
  • And 22 additional diagnostic messages.

Valgrind

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '((Long) 0x8000000000000000ULL)' is negative. guest_arm64_toIR.c 9428


static
Bool dis_AdvSIMD_scalar_shift_by_imm(DisResult* dres, UInt insn)
{
  ....
  ULong nmask = (ULong)(((Long)0x8000000000000000ULL) >> (sh-1));
  ....
}

EFL Core Libraries

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '(- 0x7fffffff - 1)' is negative. ector_software_gradient.c 412


void fetch_linear_gradient(....)
{
  ....
  if (t + inc*length < (float)(INT_MAX >> (FIXPT_BITS + 1)) &&
      t+inc*length > (float)(INT_MIN >> (FIXPT_BITS + 1)))
  ....
}

Audacity

V610 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. ExportFFmpeg.cpp 229


#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)

ExportFFmpeg::ExportFFmpeg() : ExportPlugin()
{
  ....
  int canmeta = ExportFFmpegOptions::fmts[newfmt].canmetadata;
  if (canmeta && (canmeta == AV_VERSION_INT(-1,-1,-1)  // <=
               || canmeta <= avfver))
  {
    SetCanMetaData(true,fmtindex);
  }
  ....
}

XNU kernel

V610 CWE-758 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. pf_table.c 976


static void
pfr_prepare_network(union sockaddr_union *sa, int af, int net)
{
  ....
  sa->sin.sin_addr.s_addr = net ? htonl(-1 << (32-net)) : 0;
  ....
}

Negative values shift is undefined behavior.

Similar errors can be found in some other places:

  • V610 CWE-758 Undefined behavior. Check the shift operator '<<'. The left operand '-1' is negative. pf_table.c 983

RT-Thread

V610 CWE-758 Undefined behavior. Check the shift operator '<<'. The left operand '(~0x00000001)' is negative. hibernate.c 2135


#define HIB_TPIO_EN0            0x00000001  // TMPR0 Enable

void
HibernateTamperIODisable(uint32_t ui32Input)
{
  ....
  HWREG(HIB_TPIO) &= ((~HIB_TPIO_EN0) << (ui32Input << 3));
  ....
}

System Shock

V610 Undefined behavior. Check the shift operator '<<'. The left operand is negative ('((rand() % 4000) - 2000)' = [-2000..1999]). STAR.C 407


void star_rand(uchar col,uchar range)
{
  ....
  v.gX = ((rand()%4000) - 2000) << 8;
  v.gY = ((rand()%4000) - 2000) << 8;
  v.gZ = ((rand()%4000) - 2000) << 8;
  ....
}

System Shock

V610 Undefined behavior. Check the shift operator '<<'. The left operand is negative ('(axis_x - 1)' = [-1..2147483646]). ALLOC.C 122


short g3_init(short max_points, int user_x_axis,
               int user_y_axis, int user_z_axis)
{
  ....
  long axis_x;
  ....
  if (user_x_axis<0)
  {
    user_x_axis = -user_x_axis;
  }
  ....
  axis_x = user_x_axis;
  ....
  axis_x_ofs = ((axis_x-1)<<1) + (axis_x-1);
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand is negative ('(axis_y - 1)' = [-1..2147483646]). ALLOC.C 123
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand is negative ('(axis_z - 1)' = [-1..2147483646]). ALLOC.C 124

System Shock

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('i' = [1..64]) is greater than or equal to the length in bits of the promoted left operand. CARDMFD.C 121


void mfd_accesscard_expose(MFD* mfd, ubyte control)
{
  ....
  ulong bits;
  ....
  for (i = 1; i <= sizeof(ulong)*8; i++)
  {
    if (bits & (1 << i))
    {
      ....
    }
  }
  ....
}

Qt

V610 CWE-758 Unspecified behavior. Check the shift operator '>>'. The left operand '(- 2147483647 - 1)' is negative. qdrawhelper.cpp 4015


template<class GradientBase, typename BlendType>
static inline const BlendType * QT_FASTCALL
qt_fetch_linear_gradient_template(....)
{
  ....
  if (t+inc*length < qreal(INT_MAX >> (FIXPT_BITS + 1)) &&
      t+inc*length > qreal(INT_MIN >> (FIXPT_BITS + 1))) {
  ....
}

SpeedCrunch

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. floatlogic.c 64


static char
_signextend(
  t_longint* longint)
{
  unsigned mask;
  signed char sign;

  sign = _signof(longint);
  mask = (~0) << SIGNBIT;  // <=
  if (sign < 0)
    longint->value[MAXIDX] |= mask;
  else
    longint->value[MAXIDX] &= ~mask;
  return sign;
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. floatnum.c 289
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. floatnum.c 325
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(- 1)' is negative. floatnum.c 344
  • And 1 additional diagnostic messages.

TON

V610 Unspecified behavior. Check the shift operator '>>'. The left operand '-0x100' is negative. bigint.hpp 1925


template <class Tr>
bool AnyIntView<Tr>::export_bits_any(....) const {
  ....
  int mask = (-0x100 >> offs) & 0xff;
  ....
}

Command & Conquer

V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. MP.CPP 2410


void XMP_Randomize(digit * result, Straw & rng, int total_bits, int precision)
{
  ....
  ((unsigned char*)result)[nbytes-1] &=
    (unsigned char)(~((~0) << (total_bits % 8)));
  ....
}

Command & Conquer

V610 Undefined behavior. Check the shift operator '<<'. The right operand ('(32 - bits_to_shift)' = [1..32]) is greater than or equal to the length in bits of the promoted left operand. MP.CPP 659


#define  UNITSIZE 32

void XMP_Shift_Right_Bits(digit * number, int bits, int precision)
{
  ....
  int digits_to_shift = bits / UNITSIZE;
  int bits_to_shift = bits % UNITSIZE;

  int index;
  for (index = digits_to_shift; index < (precision-1); index++) {
    *number = (*(number + digits_to_shift) >> bits_to_shift) |
      (*(number + (digits_to_shift + 1)) << (UNITSIZE - bits_to_shift));
    number++;
  }
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(~0)' is negative. TARGET.H 66
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(((- 24) * 256) / 24)' is negative. ANIM.CPP 160
  • V610 Undefined behavior. Check the shift operator '<<'. The left operand '(((- 12) * 256) / 24)' is negative. BUILDING.CPP 4037
  • And 27 additional diagnostic messages.

PMDK

V610 [CWE-758] Unspecified behavior. Check the shift operator '>>'. The left operand '~0' is negative. clo.cpp 205


static int
clo_parse_single_uint(struct benchmark_clo *clo, const char *arg, void *ptr)
{
  ....
  uint64_t tmax = ~0 >> (64 - 8 * clo->type_uint.size);
  ....
}

Qemu

V610 Unspecified behavior. Check the shift operator '>>'. The left operand is negative ('number' = [-32768..2147483647]). cris.c 2111


static void
print_with_operands (const struct cris_opcode *opcodep,
         unsigned int insn,
         unsigned char *buffer,
         bfd_vma addr,
         disassemble_info *info,
         const struct cris_opcode *prefix_opcodep,
         unsigned int prefix_insn,
         unsigned char *prefix_buffer,
         bfd_boolean with_reg_prefix)
{
  ....
  int32_t number;
  ....
  if (signedp && number > 127)
    number -= 256;
  ....
  if (signedp && number > 32767)
    number -= 65536;
  ....
  unsigned int highbyte = (number >> 24) & 0xff;
  ....
}

Boost (C++ libraries)

V610 Undefined behavior. Check the shift operator '<<='. The right operand is negative ('shift_by' = [-64..64]). cpp_expression_value.hpp(676)


typedef long int_literal_type;
typedef unsigned long uint_literal_type;

union {
  int_literal_type i;
  uint_literal_type ui;
  bool b;
} value;

closure_value &
operator<<= (closure_value const &rhs)
{
    switch (type) {
    case is_bool:
    case is_int:
        switch (rhs.type) {
        case is_bool:
        case is_int:
            {
            int_literal_type shift_by = as_long(rhs);

                if (shift_by > 64)
                    shift_by = 64;
                else if (shift_by < -64)
                    shift_by = -64;
                value.i <<= shift_by;
            }
            break;
  ....
}

Similar errors can be found in some other places:

  • V610 Undefined behavior. Check the shift operator '>>='. The right operand is negative ('shift_by' = [-64..64]). cpp_expression_value.hpp(771)
  • V610 Undefined behavior. Check the shift operator '>>='. The right operand is negative ('shift_by' = [-64..64]). cpp_expression_value.hpp(741)
  • V610 Undefined behavior. Check the shift operator '<<='. The right operand is negative ('shift_by' = [-64..64]). cpp_expression_value.hpp(706)

This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept