Our website uses cookies to enhance your browsing experience.
Accept
to the top
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

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V796…

Examples of errors detected by the V796 diagnostic

V796. A 'break' statement is probably missing in a 'switch' statement.


Chromium

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. command_buffer_metrics.cc 125


void RecordContextLost(ContextType type,
                       CommandBufferContextLostReason reason) {
  switch (type) {
    ....
    case MEDIA_CONTEXT:
      UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.Media",
        reason, CONTEXT_LOST_REASON_MAX_ENUM);
      break;
    case MUS_CLIENT_CONTEXT:
      UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.MusClient",
        reason, CONTEXT_LOST_REASON_MAX_ENUM);
      break;
    case UI_COMPOSITOR_CONTEXT:
      UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.UICompositor",
        reason, CONTEXT_LOST_REASON_MAX_ENUM);
    case CONTEXT_TYPE_UNKNOWN:
      UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.Unknown",
        reason, CONTEXT_LOST_REASON_MAX_ENUM);
      break;
  }
}

Chromium

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. system_input_injector_mus.cc 78


void SystemInputInjectorMus::InjectMouseButton(
  ui::EventFlags button, bool down)
{
  ....
  int modifier = ui::MODIFIER_NONE;
  switch (button) {
    case ui::EF_LEFT_MOUSE_BUTTON:
      modifier = ui::MODIFIER_LEFT_MOUSE_BUTTON;
      break;
    case ui::EF_RIGHT_MOUSE_BUTTON:
      modifier = ui::MODIFIER_RIGHT_MOUSE_BUTTON;
      break;
    case ui::EF_MIDDLE_MOUSE_BUTTON:
      modifier = ui::MODIFIER_MIDDLE_MOUSE_BUTTON;
    default:
      LOG(WARNING) << "Invalid flag: " << button
                   << " for the button parameter";
      return;
  }
  ....
}

Android

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. a2dp_vendor_ldac.cc 912


bool A2dpCodecConfigLdac::setCodecConfig(....) {
  ....
  case BTAV_A2DP_CODEC_SAMPLE_RATE_192000:
    if (sampleRate & A2DP_LDAC_SAMPLING_FREQ_192000) {
      result_config_cie.sampleRate =
          A2DP_LDAC_SAMPLING_FREQ_192000;
      codec_capability_.sample_rate =
          codec_user_config_.sample_rate;
      codec_config_.sample_rate =
          codec_user_config_.sample_rate;
    }
  case BTAV_A2DP_CODEC_SAMPLE_RATE_16000:
  case BTAV_A2DP_CODEC_SAMPLE_RATE_24000:
  case BTAV_A2DP_CODEC_SAMPLE_RATE_NONE:
    codec_capability_.sample_rate =
        BTAV_A2DP_CODEC_SAMPLE_RATE_NONE;
    codec_config_.sample_rate =
        BTAV_A2DP_CODEC_SAMPLE_RATE_NONE;
    break;
  ....
}

Android

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. IAndroidConfiguration.cpp 90


static SLresult IAndroidConfiguration_GetConfiguration(....)
{
  ....
  switch (IObjectToObjectID((thiz)->mThis)) {
  case SL_OBJECTID_AUDIORECORDER:
    result = android_audioRecorder_getConfig(
      (CAudioRecorder *) thiz->mThis, configKey,
      pValueSize, pConfigValue);
    break;
  case SL_OBJECTID_AUDIOPLAYER:
    result = android_audioPlayer_getConfig(
      (CAudioPlayer *) thiz->mThis, configKey,
      pValueSize, pConfigValue);
  default:
    result = SL_RESULT_FEATURE_UNSUPPORTED;
    break;
  }
  ....
}

Android

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. EffectsFactory.cpp 118


Return<void> EffectsFactory::getAllDescriptors(....)  {
  ....
  switch (status) {
    case -ENOSYS: {
      // Effect list has changed.
      goto restart;
    }
    case -ENOENT: {
      // No more effects available.
      result.resize(i);
    }
    default: {
      result.resize(0);
      retval = Result::NOT_INITIALIZED;
    }
  }
  ....
}

Android

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. EffectReverb.cpp 1847


int Reverb_getParameter(....)
{
  ....
  case REVERB_PARAM_REFLECTIONS_LEVEL:
    *(uint16_t *)pValue = 0;
  case REVERB_PARAM_REFLECTIONS_DELAY:
    *(uint32_t *)pValue = 0;
  case REVERB_PARAM_REVERB_DELAY:
    *(uint32_t *)pValue = 0;
  break;
  ....
}

System Shock

V796 It is possible that 'break' statement is missing in switch statement. OLH.C 142


bool olh_candidate(ObjID obj)
{
  ....
  switch (objs[obj].obclass)
  {
    case CLASS_DOOR:
      ....
      break;
    case CLASS_BIGSTUFF:
      ....
      if (....)
      {
        ....
        break;
      }
    case CLASS_SMALLSTUFF:
      ....
      if (....)
      {
        ....
        break;
      }
    // smallstuff falls through to default.
    default:
      ....
      break;
  }
}

Similar errors can be found in some other places:

  • V796 It is possible that 'break' statement is missing in switch statement. GAMEREND.C 777

Godot Engine

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. gdscript_compiler.cpp 135


GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(
  const GDScriptParser::DataType &p_datatype) const
{
  ....
  switch (p_datatype.kind) {
     ....
    case GDScriptParser::DataType::NATIVE: {
      result.kind = GDScriptDataType::NATIVE;
      result.native_type = p_datatype.native_type;
    } break;
    case GDScriptParser::DataType::SCRIPT: {
      result.kind = GDScriptDataType::SCRIPT;
      result.script_type = p_datatype.script_type;
      result.native_type = result.script_type->get_instance_base_type();
    }
    case GDScriptParser::DataType::GDSCRIPT: {
      result.kind = GDScriptDataType::GDSCRIPT;
      result.script_type = p_datatype.script_type;
      result.native_type = result.script_type->get_instance_base_type();
    } break;
  ....
}

GPCS4

V796 CWE-484 It is possible that 'break' statement is missing in switch statement. AudioOut.cpp 137


static AudioProperties getAudioProperties(uint32_t param)
{
  uint32_t format       = param & 0x000000ff;
  AudioProperties props = {};

  switch (format)
  {
    ....
    case SCE_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:
    {
      props.nChannels   = 8;
      props.bytesPerSample  = 2;
      props.audioFormat = RTAUDIO_FORMAT_SINT16;
      break;
    }
    case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:
    {
      props.nChannels   = 1;
      props.bytesPerSample  = 4;
      props.audioFormat = RTAUDIO_FORMAT_FLOAT32;
    }
    case SCE_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:
    {
      props.nChannels   = 2;
      props.bytesPerSample  = 4;
      props.audioFormat = RTAUDIO_FORMAT_FLOAT32;
      break;
    }
  }
  return props;
}

DPDK

V796 It is possible that 'break' statement is missing in switch statement. e1000_api.c 297


s32 e1000_set_mac_type(struct e1000_hw *hw)
{
  ....
  switch (hw->device_id) {
  ....
  case E1000_DEV_ID_PCH_ADL_I219_LM16:
  case E1000_DEV_ID_PCH_ADL_I219_V16:
  case E1000_DEV_ID_PCH_RPL_I219_LM23:
  case E1000_DEV_ID_PCH_RPL_I219_V23:
    mac->type = e1000_pch_tgp;           // <=
  case E1000_DEV_ID_PCH_ADL_I219_LM17:
  case E1000_DEV_ID_PCH_ADL_I219_V17:
  case E1000_DEV_ID_PCH_RPL_I219_LM22:
  case E1000_DEV_ID_PCH_RPL_I219_V22:
    mac->type = e1000_pch_adp;           // <=
    break;
  case E1000_DEV_ID_82575EB_COPPER:
  case E1000_DEV_ID_82575EB_FIBER_SERDES:
  case E1000_DEV_ID_82575GB_QUAD_COPPER:
    mac->type = e1000_82575;
    break;
  ....
  }
  ....
}