Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the V784…

Examples of errors detected by the V784 diagnostic

V784. The size of the bit mask is less than the size of the first operand. This will cause the loss of the higher bits.


Perl 5

V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. inffast.c 296


void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
{
  ....
  unsigned long hold;         /* local strm->hold */
  unsigned bits;              /* local strm->bits */
  ....
  hold &= (1U << bits) - 1;
  ....
}

LLVM/Clang

V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. RuntimeDyld.cpp 815


unsigned getStubAlignment() override {
  if (Arch == Triple::systemz)
    return 8;
  else
    return 1;
}

Expected<unsigned>
RuntimeDyldImpl::emitSection(const ObjectFile &Obj,
                             const SectionRef &Section,
                             bool IsCode) {
  ....
  uint64_t DataSize = Section.getSize();
  ....
  if (StubBufSize > 0)
    DataSize &= ~(getStubAlignment() - 1);
  ....
}

Qemu

V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. cadence_gem.c 1486


typedef struct CadenceGEMState {
  ....
  uint32_t regs_ro[CADENCE_GEM_MAXREG];
}
....
static void gem_write(void *opaque, hwaddr offset, uint64_t val,
        unsigned size)
{
  ....
  val &= ~(s->regs_ro[offset]);
  ....
}

LLVM/Clang

V784 [CWE-197, CERT-INT31-C] The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. Types.h 529


uint64_t NullabilityPayload = 0;

static constexpr const unsigned NullabilityKindMask = 0x3;

void addTypeInfo(unsigned index, NullabilityKind kind) {
  ....
  NullabilityPayload &=
    ~(NullabilityKindMask << (index * NullabilityKindSize));
  ....
}

iSulad

V784 [CWE-197, CERT-INT31-C] The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. utils_fs.c 257


struct mount_option_element {
  const char *option;
  bool clear;
  int flag;
};

static void do_parse_mntopt(const char *opt, unsigned long *mflags, char **data)
{
  size_t i = 0;

  for (i = 0; i < sizeof(g_mount_options) / sizeof(g_mount_options[0]); i++) {
    if (strncmp(opt, g_mount_options[i].option,
                strlen(g_mount_options[i].option)) == 0) {
      if (g_mount_options[i].clear) {
        *mflags &= ~g_mount_options[i].flag;
  ....
}

DPDK

V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. hinic_pmd_flow.c 2292


#define HINIC_MAX_Q_FILTERS  64 /* hinic just support 64 filter types */

/* Structure to store filters' info. */
struct hinic_filter_info {
  ....
  uint64_t type_mask;  /* Bit mask for every used filter */
  ....
};

static inline void
hinic_ethertype_filter_remove(struct hinic_filter_info *filter_info,
            uint8_t idx)
{
  if (idx >= HINIC_MAX_Q_FILTERS)
    return;

  filter_info->pkt_type = 0;
  filter_info->type_mask &= ~(1 << idx);
  filter_info->pkt_filters[idx].pkt_proto = (uint16_t)0;
  filter_info->pkt_filters[idx].enable = FALSE;
  filter_info->pkt_filters[idx].qid = 0;
}

Similar errors can be found in some other places:

  • V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. dpaa2_sec_dpseci.c 1755
  • V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. dpaa_sec.c 1913
  • V784 The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. dpaa_eventdev.c 104
  • And 7 additional diagnostic messages.

close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

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

close form
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

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

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam