summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2023-09-15 11:40:41 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2023-09-17 18:33:47 +0000
commit2fd4a86dc5547d6ff3f512bd33ccf6e10d159ff4 (patch)
tree22b71fcb147f64a255ffbe94c8192d48e2f1d52b /src/corelib/serialization
parentb0ba5c78eee0a476f5ab3e55e3bf3b5476e481c4 (diff)
QDataStream: prevent accidental streaming of pointers
It doesn't make sense to stream a pointer, but it can happen by accident because ds << ptr will select the operator<<(bool) overload. Disable the out-stream operator for pointers by having a better match. Reading a pointer from a QDataStream doesn't work, as a pointer can't bind to e.g. a bool non-const reference. [ChangeLog][QtCore][QDataStream] Streaming of arbitrary pointers using QDataStream has been disabled. Note that such streaming happened through the streaming operator for bool. Change-Id: I4c98a33b52aae85e441f5a096efd404fbbf1e95f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r--src/corelib/serialization/qdatastream.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h
index 69a7765064..e5ae55402a 100644
--- a/src/corelib/serialization/qdatastream.h
+++ b/src/corelib/serialization/qdatastream.h
@@ -157,6 +157,7 @@ public:
QDataStream &operator<<(const char *str);
QDataStream &operator<<(char16_t c);
QDataStream &operator<<(char32_t c);
+ QDataStream &operator<<(const volatile void *) = delete;
QDataStream &readBytes(char *&, uint &len);