From cd29cab883a6a7a0e028ca6756daa2f3cc8d51f6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 26 Jun 2014 09:35:13 +0100 Subject: check for self-assign Change-Id: I6ffaaa36f2e594a2e8155589a4d7000db21ab30b --- tools/source/generic/bigint.cxx | 3 +++ tools/source/generic/poly2.cxx | 3 +++ 2 files changed, 6 insertions(+) (limited to 'tools') diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index e7a98b5eebec..3311efd459b5 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -616,6 +616,9 @@ BigInt::operator double() const BigInt& BigInt::operator=( const BigInt& rBigInt ) { + if (this == &rBigInt) + return *this; + if ( rBigInt.bIsBig ) memcpy( (void*)this, (const void*)&rBigInt, sizeof( BigInt ) ); else diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 7ef7df199f4f..0262a36a0af6 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -521,6 +521,9 @@ Polygon& PolyPolygon::operator[]( sal_uInt16 nPos ) PolyPolygon& PolyPolygon::operator=( const PolyPolygon& rPolyPoly ) { + if (this == &rPolyPoly) + return *this; + DBG_ASSERT( rPolyPoly.mpImplPolyPolygon->mnRefCount < 0xFFFFFFFE, "PolyPolygon: RefCount overflow" ); rPolyPoly.mpImplPolyPolygon->mnRefCount++; -- cgit