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 V794…

Examples of errors detected by the V794 diagnostic

V794. The assignment operator should be protected from the case of this == &src.


Chromium

V794 The copy operator should be protected from the case of 'this == &other'. vector_buffer.h 59


VectorBuffer& operator=(VectorBuffer&& other) {
  free(buffer_);
  buffer_ = other.buffer_;
  capacity_ = other.capacity_;

  other.buffer_ = nullptr;
  other.capacity_ = 0;
  return *this;
}

There is no protection in case the object is moved within itself.

Similar errors can be found in some other places:

  • V794 The copy operator should be protected from the case of 'this == &other'. gurl.cc 138
  • V794 The copy operator should be protected from the case of 'this == &other'. spdy_protocol.h 890
  • V794 The copy operator should be protected from the case of 'this == &other'. crypto_handshake_message.cc 41
  • And 6 additional diagnostic messages.

ANGLE

V794 The copy operator should be protected from the case of 'this == &other'. error.inl 56


Error &Error::operator=(const Error &other)
{
    mCode = other.mCode;
    mID = other.mID;

    if (other.mMessage)
    {
        createMessageString();
        *mMessage = *(other.mMessage);
    }
    else
    {
        mMessage.release();
    }

    return *this;
}

There is no protection for the case when the object is copied in itself.

Similar errors can be found in some other places:

  • V794 The copy operator should be protected from the case of 'this == &other'. error.inl 145
  • V794 The copy operator should be protected from the case of 'this == &t'. types.cpp 250

RE2

V794 The copy operator should be protected from the case of 'this == &src'. sparse_array.h 362


template<typename Value>
SparseArray<Value>& SparseArray<Value>::operator=(
  const SparseArray& src)
{
  size_ = src.size_;
  max_size_ = src.max_size_;
  std::unique_ptr<int[]> a(new int[max_size_]);
  std::copy_n(src.sparse_.get(), src.max_size_, a.get());
  sparse_ = std::move(a);
  std::unique_ptr<IndexValue[]> b(new IndexValue[max_size_]);
  std::copy_n(src.dense_.get(), src.max_size_, b.get());
  dense_ = std::move(b);
  return *this;
}

There is no protection for the case when the object is copied in itself.


WebRTC

V794 The copy operator should be protected from the case of 'this == &other'. desktop_region.cc 50


DesktopRegion& DesktopRegion::operator=(
  const DesktopRegion& other)
{
  Clear();
  rows_ = other.rows_;
  for (Rows::iterator it = rows_.begin();
       it != rows_.end(); ++it) {
    // Copy each row.
    Row* row = it->second;
    it->second = new Row(*row);
  }
  return *this;
}

There is no protection for the case when the object is copied in itself.


EA WebKit

V794 The copy operator should be protected from the case of 'this == &other'. transformstate.cpp 30


TransformState& TransformState::operator=(
  const TransformState& other)
{
  accumulated_offset_ = other.accumulated_offset_;
  map_point_ = other.map_point_;
  map_quad_ = other.map_quad_;
  if (map_point_)
    last_planar_point_ = other.last_planar_point_;
  if (map_quad_)
    last_planar_quad_ = other.last_planar_quad_;
  accumulating_transform_ = other.accumulating_transform_;
  force_accumulating_transform_ =
    other.force_accumulating_transform_;
  direction_ = other.direction_;

  accumulated_transform_.reset();

  if (other.accumulated_transform_)
    accumulated_transform_ =
     TransformationMatrix::Create(*other.accumulated_transform_);

  return *this;
}

There is no protection for the case when the object is copied in itself.


TDLib

V794 The assignment operator should be protected from the case of 'this == &other'. status.h 340


Result &operator=(Result &&other) {
  if (status_.is_ok()) {
    value_.~T();
  }
  if (other.status_.is_ok()) {
    ....
    new (&value_) T(std::move(other.value_));
    ....
    other.value_.~T();
  }
  status_ = std::move(other.status_);
  other.status_ = Status::Error();
  return *this;
}

Android

V794 The assignment operator should be protected from the case of 'this == &other'. HidlSupport.h 421


hidl_vec &operator=(hidl_vec &&other) noexcept {
  if (mOwnsBuffer) {
    delete[] mBuffer;
  }
  mBuffer = other.mBuffer;
  mSize = other.mSize;
  mOwnsBuffer = other.mOwnsBuffer;
  other.mOwnsBuffer = false;
  return *this;
}

LibreOffice

V794 The assignment operator should be protected from the case of 'this == &rToBeCopied'. hommatrixtemplate.hxx 121


ImplHomMatrixTemplate& operator=(....)
{
  // complete initialization using copy
  for(sal_uInt16 a(0); a < (RowSize - 1); a++)
  {
    memcpy(&maLine[a], &rToBeCopied.maLine[a], sizeof(....));
  }
  if(rToBeCopied.mpLine)
  {
    mpLine.reset( new ImplMatLine< RowSize >(....) );
  }
  return *this;
}

SpeedCrunch

V794 The assignment operator should be protected from the case of 'this == &other'. quantity.cpp 373


Quantity& Quantity::operator=(const Quantity& other)
{
  m_numericValue = other.m_numericValue;
  m_dimension = other.m_dimension;
  m_format = other.m_format;
  stripUnits();
  if(other.hasUnit()) {
    m_unit = new CNumber(*other.m_unit);
    m_unitName = other.m_unitName;
  }
  cleanDimension();
  return *this;
}

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