diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-06 12:58:56 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-11 22:39:43 +0000 |
commit | b4ab4868bc8422e09590d13d35c2bba7a195ccf5 (patch) | |
tree | c5239e6e67d048c35a077356f5479c3d5dae456a /LICENSE.GPLv3 | |
parent | 71ea41f999c1dbe83cba2491f5ac99d6c5a3d98c (diff) |
Fix UB in QFSFileEnginePrivate::writeFdFh()
Apparently, it is considered valid to call the function with
'data' set to nullptr, and 'len' to zero. But doing so
invokes undefined behavior because nullptr is passed to
fwrite().
Fix by protecting the loops with 'if (len)'.
Found by UBSan:
qtbase/src/corelib/io/qfsfileengine.cpp:732:84: runtime error: null pointer passed as argument 1, which is declared to never be null
Change-Id: Idfe23875c868ebb21d2164550de3304d2f01e9df
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'LICENSE.GPLv3')
0 files changed, 0 insertions, 0 deletions