Commit c38b14e2 authored by Marc Mutz's avatar Marc Mutz
Browse files

Fix UB in tst_QSharedPointer::basics()


Binding a reference to the nullptr is undefined
behavior.

Just skip that particular test when 'ptr' is null.

Found by UBSan:
  tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp:258:32: runtime error: reference binding to null pointer of type 'struct Data'

Change-Id: I125588b9d269a6f76716d660d03142f409513885
Reviewed-by: default avatarJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: default avatarLars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
parent 9c7be0a7
Showing with 4 additions and 2 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment