Мы используем куки, чтобы пользоваться сайтом было удобно.
Хорошо
to the top
close form

Заполните форму в два простых шага ниже:

Ваши контактные данные:

Шаг 1
Поздравляем! У вас есть промокод!

Тип желаемой лицензии:

Шаг 2
Team license
Enterprise license
** Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности
close form
Запросите информацию о ценах
Новая лицензия
Продление лицензии
--Выберите валюту--
USD
EUR
RUB
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Бесплатная лицензия PVS‑Studio для специалистов Microsoft MVP
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Для получения лицензии для вашего открытого
проекта заполните, пожалуйста, эту форму
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Мне интересно попробовать плагин на:
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
check circle
Ваше сообщение отправлено.

Мы ответим вам на


Если вы так и не получили ответ, пожалуйста, проверьте, отфильтровано ли письмо в одну из следующих стандартных папок:

  • Промоакции
  • Оповещения
  • Спам

Вебинар: Использование статических анализаторов кода при разработке безопасного ПО - 19.12

>
>
>
Примеры ошибок, обнаруженных с помощью …

Примеры ошибок, обнаруженных с помощью диагностики V591

V591. Non-void function must return value.


Quake-III-Arena

V591 Non-void function should return a value. botlib q_shared.h 155


static ID_INLINE int BigLong(int l)
{ LongSwap(l); }

Need: { return LongSwap(l); }

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. botlib q_shared.h 157

Haiku Operation System

V591 Non-void function should return a value. pc.c 1031


ULONG
set_var(char *name, ULONG val)
{
  variable *v;

  v = lookup_var(name);
  if (v != NULL)
    v->value = val;
  else
    add_var(name, val);
}

SETI@home

V591 Non-void function should return a value. x86_float4.h 237


struct float4
{
  ....
  inline float4 rsqrt() const {
  }
  inline float4 sqrt() const {
  }
  inline float4 recip() const {
  }
  ....
};

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. x86_float4.h 239
  • V591 Non-void function should return a value. x86_float4.h 241

Unreal Engine 4

V591 Non-void function should return a value. slistview.h 53


class FColumnHeaderSlot
{
public:
  FColumnHeaderSlot& operator[](
    const TSharedRef< SHeaderRow >& InColumnHeaders )
  {
    HeaderRow = InColumnHeaders;
  }
  ....
}

Missing return *this.


Open X-Ray Engine

V591 Non-void function should return a value. _matrix33.h 435


template <class T>
struct _matrix33
{
public:
  typedef _matrix33<T>Self;
  typedef Self& SelfRef;
  ....
  IC SelfRef sMTxV(Tvector& R, float s1, const Tvector& V1) const
  {
    R.x = s1*(m[0][0] * V1.x + m[1][0] * V1.y + m[2][0] * V1.z);
    R.y = s1*(m[0][1] * V1.x + m[1][1] * V1.y + m[2][1] * V1.z);
    R.z = s1*(m[0][2] * V1.x + m[1][2] * V1.y + m[2][2] * V1.z);
  }
  ....
}

Chromium

V591 Non-void function should return a value. memory_allocator.h 39


CheckReturnValue& operator=(const CheckReturnValue& other) {
  if (this != &other) {
    DCHECK(checked_);
    value_ = other.value_;
    checked_ = other.checked_;
    other.checked_ = true;
  }
}

Missing return *this.


LLVM/Clang

V591 Non-void function should return a value. RPCUtils.h 719


SequenceNumberManager &operator=(SequenceNumberManager &&Other) {
  NextSequenceNumber = std::move(Other.NextSequenceNumber);
  FreeSequenceNumbers = std::move(Other.FreeSequenceNumbers);
}

Aspell

V591 Non-void function should return a value. lsort.hpp 159


template <class N>
static inline N * fix_links(N * cur)
{
  N * prev = 0;
  while (cur) {
    cur->prev = prev;
    prev = cur;
    cur = cur->next;
  }
}

EFL Core Libraries

V591 Non-void function should return a value. ecore_evas_extn.c 1526


static Eina_Bool
_ipc_server_data(void *data, int type EINA_UNUSED, void *event)
{
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (indicator_buffer_skip)
    return;
  //END
  ....
  //TIZEN_ONLY(170317): add skipping indicator buffer logic
  if (_ecore_evas_indicator_size_check(ee, &(extn->b[n].w)))
    {
       indicator_buffer_skip = EINA_TRUE;
       return;                                  // <=
    }
  else
    indicator_buffer_skip = EINA_FALSE;
  //END
  ....
}

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. ecore_evas_extn.c 1617

EFL Core Libraries

V591 Non-void function should return a value. eina_accessor.hh 330


_self_type& operator=(_self_type const& other)
{
  _base_type::operator=(other);
}

Android

V591 CWE-393 Non-void function should return a value. linux_close.cpp 139


int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
       struct sockaddr *from, int *fromlen) {
  socklen_t socklen = *fromlen;
  BLOCKING_IO_RETURN_INT(
    s, recvfrom(s, buf, len, flags, from, &socklen) );
  *fromlen = socklen;
}

Similar errors can be found in some other places:

  • V591 CWE-393 Non-void function should return a value. linux_close.cpp 158

NCBI Genome Workbench

V591 Non-void function should return a value. bio_tree.hpp 266


/// Recursive assignment
CBioNode& operator=(const CBioNode& tree)
{
  TParent::operator=(tree);
  TBioTree* pt = (TBioTree*)tree.GetParentTree();
  SetParentTree(pt);
}

Haiku Operation System

V591 Non-void function should return a value. Referenceable.h 228


BReference& operator=(const BReference<const Type>& other)
{
  fReference = other.fReference;
}

Similar errors can be found in some other places:

  • V591 Non-void function should return a value. Referenceable.h 233
  • V591 Non-void function should return a value. Referenceable.h 239

Haiku Operation System

V591 Non-void function should return a value. main.c 1010


void errx(int, const char *, ...) ;

char *
getoptionvalue(const char *name)
{
  struct option *c;

  if (name == NULL)
    errx(1, "getoptionvalue() invoked with NULL name");
  c = getoption(name);
  if (c != NULL)
    return (c->value);
  errx(1, "getoptionvalue() invoked with unknown option `%s'", name);
  /* NOTREACHED */
}

'errx' doesn't contain noreturn attribute.


ROOT

V591 Non-void function should return a value. LogLikelihoodFCN.h 108


LogLikelihoodFCN & operator = (const LogLikelihoodFCN & rhs) {
  SetData(rhs.DataPtr() );
  SetModelFunction(rhs.ModelFunctionPtr() );
  fNEffPoints = rhs.fNEffPoints;
  fGrad = rhs.fGrad;
  fIsExtended = rhs.fIsExtended;
  fWeight = rhs.fWeight;
  fExecutionPolicy = rhs.fExecutionPolicy;
}

Command & Conquer

V591 Non-void function should return a value. HEAP.H 123


int FixedHeapClass::Free(void * pointer);

template<class T>
class TFixedHeapClass : public FixedHeapClass
{
  ....
  virtual int Free(T * pointer) {FixedHeapClass::Free(pointer);};
};

Strf

V591 Non-void function should return a value. numpunct.hpp 402


template <int Base>
class numpunct: private strf::digits_grouping
{
  ....
  constexpr STRF_HD numpunct& operator=(const numpunct& other) noexcept
  {
    strf::digits_grouping::operator=(other);
    decimal_point_ = other.decimal_point_;
    thousands_sep_ = other.thousands_sep_;
  }
  ....
};

Strf

V591 Non-void function should return a value. numpunct.hpp 528


template <int Base>
class no_grouping final
{
  constexpr STRF_HD no_grouping& operator=(const no_grouping& other) noexcept
  {
    decimal_point_ = other.decimal_point_;
  }
  ....
}

Chobo Single-Header Libraries

V591 Non-void function should return a value. vector_view.hpp 163


template <typename T, typename U, typename Alloc = std::allocator<T>>
class vector_view
{
  ....
  vector_view& operator=(vector_view&& other)
  {
    m_vector = std::move(other.m_vector);
  }
  ....
}

Chobo Single-Header Libraries

V591 Non-void function should return a value. vector_view.hpp 184


template <typename UAlloc>
vector_view& operator=(const std::vector<U, UAlloc>& other)
{
  size_type n = other.size();
  resize(n);
  for (size_type i = 0; i < n; ++i)
  {
    this->at(i) = other[i];
  }
}

PpluX

V591 Non-void function should return a value. px_render.h 398


struct DisplayList {
  DisplayList& operator=(DisplayList &&d) {
    data_ = d.data_;
    d.data_ = nullptr;
  }
  ....
}

Universal

V591 Non-void function should return a value. matrix.hpp 109


template<typename Scalar>
class matrix {
  ....
  matrix& diagonal() {
  }
  ....
};

manif

V591 Non-void function should return a value. lie_group_base.h 347


template <typename _Derived>
typename LieGroupBase<_Derived>::Scalar*
LieGroupBase<_Derived>::data()
{
  return derived().coeffs().data();     // OK
}

template <typename _Derived>
const typename LieGroupBase<_Derived>::Scalar*
LieGroupBase<_Derived>::data() const
{
  derived().coeffs().data();            // ERROR
}

qdEngine

V591 [CWE-393, CERT-MSC52-CPP] Non-void function should return a value. qd_sound.h 70


class qdSound : public qdNamedObject, public qdResource
{
  ....
  float length() const {
#ifndef __QD_SYSLIB__
    return sound_.length();
#endif
  }
  ....
}

LLVM/Clang

V591 Non-void function should return a value. tools.cpp:1278


static bool StopAtComponentPre(const Symbol &component) {
  if constexpr (componentKind == ComponentKind::Ordered) {
    // Parent components need to be iterated upon after their
    // sub-components in structure constructor analysis.
    return !component.test(Symbol::Flag::ParentComp);
  } else if constexpr (componentKind == ComponentKind::Direct) {
    return true;
  } else if constexpr (componentKind == ComponentKind::Ultimate) {
    return component.has<ProcEntityDetails>()  ||
      IsAllocatableOrObjectPointer(&component) ||
           (component.has<ObjectEntityDetails>() &&
            component.get<ObjectEntityDetails>().type() &&
            component.get<ObjectEntityDetails>().type()->AsIntrinsic());
  } else if constexpr (componentKind == ComponentKind::Potential) {
    return !IsPointer(component);
  } else if constexpr (componentKind == ComponentKind::PotentialAndPointer) {
    return true;
  }
}

OpenVINO

V591 [CERT-MSC52-CPP] Non-void function should return a value. graph_iterator_flatbuffer.hpp 29


template <typename T>
std::basic_string<T> get_model_extension() {}

Similar errors can be found in some other places:

  • V591 [CERT-MSC52-CPP] Non-void function should return a value. graph_iterator_meta.hpp 18
  • V591 [CERT-MSC52-CPP] Non-void function should return a value. graph_iterator_saved_model.hpp 19
  • V591 [CERT-MSC52-CPP] Non-void function should return a value. graph_iterator_saved_model.hpp 21

OpenVINO

V591 [CERT-MSC52-CPP] Non-void function should return a value. registers_pool.hpp 229


template <typename TReg>
int getFree(int requestedIdx)
{
  if (std::is_base_of<Xbyak::Mmx, TReg>::value)
  {
    ....
    return idx;
  }
  else if (....)
  {
    ....
    return idx;
  }
  else if (std::is_same<TReg, Xbyak::Opmask>::value)
  {
    return getFreeOpmask(requestedIdx);
  }
}

Xenia

V591 Non-void function should return a value. chrono.h 110


enum class Domain
{
  // boring host clock:
  Host,
  // adheres to guest scaling
  // (differrent speed, changing clock drift etc):
  Guest
};

template <Domain domain_>
struct NtSystemClock
{
  ....
  [[nodiscard]] static time_point now() noexcept
  {
    if constexpr (domain_ == Domain::Host)
    {
      // QueryHostSystemTime() returns
      // windows epoch times even on POSIX
      return from_file_time(Clock::QueryHostSystemTime());
    }
    else if constexpr (domain_ == Domain::Guest)
    {
      return from_file_time(Clock::QueryGuestSystemTime());
    }
  }
  ....
};

Inside the function, the domain_ data member is checked against the enum elements. While there are only two values, just like in the check, we can't be sure that there won't be extra elements in the future. Therefore, we should make the function always return a value for all execution branches, or the code should not compile.