Commit 11abce66 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Smart pointers: added safeguard against passing null pointers to memcmp

This might happen e.g. if lazy is true and synchronize() is called before the
objects are created,
parent 001a59cd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -431,6 +431,8 @@ class DevicePointer< Object, Devices::Cuda > : public SmartPointer

      bool modified()
      {
         if( ! this->pointer || ! this->last_sync_state )
            return false;
         return std::memcmp( (void*) this->last_sync_state, (void*) this->pointer, sizeof( ObjectType ) ) != 0;
      }

+2 −0
Original line number Diff line number Diff line
@@ -572,6 +572,8 @@ class SharedPointer< Object, Devices::Cuda, lazy > : public SmartPointer

      bool modified()
      {
         if( ! this->pointer )
            return false;
         return std::memcmp( (void*) (this->pointer + 1), (void*) this->pointer, sizeof( ObjectType ) ) != 0;
      }

+2 −0
Original line number Diff line number Diff line
@@ -246,6 +246,8 @@ class UniquePointer< Object, Devices::Cuda > : public SmartPointer

      bool modified()
      {
         if( ! this->pointer )
            return false;
         return std::memcmp( (void*) (this->pointer + 1), (void*) this->pointer, sizeof( ObjectType ) ) != 0;
      }