From 2fb6c1f80dd8e4faa4a8e0b2cea67470af00eedf Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Apr 2019 18:48:40 +0000 Subject: [PATCH] serialization: check stream good flag at the end just in case --- src/cryptonote_basic/cryptonote_basic.h | 2 +- src/ringct/rctTypes.h | 8 ++++---- src/serialization/serialization.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cryptonote_basic/cryptonote_basic.h b/src/cryptonote_basic/cryptonote_basic.h index 20d92bdf1..055c4a22b 100644 --- a/src/cryptonote_basic/cryptonote_basic.h +++ b/src/cryptonote_basic/cryptonote_basic.h @@ -320,7 +320,7 @@ namespace cryptonote } if (!typename Archive::is_saving()) pruned = true; - return true; + return ar.stream().good(); } private: diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index 97ffe3f96..03a52775f 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -256,7 +256,7 @@ namespace rct { { FIELD(type) if (type == RCTTypeNull) - return true; + return ar.stream().good(); if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeFullBulletproof && type != RCTTypeSimpleBulletproof) return false; VARINT_FIELD(txnFee) @@ -316,7 +316,7 @@ namespace rct { ar.delimit_array(); } ar.end_array(); - return true; + return ar.stream().good(); } }; struct rctSigPrunable { @@ -329,7 +329,7 @@ namespace rct { bool serialize_rctsig_prunable(Archive &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin) { if (type == RCTTypeNull) - return true; + return ar.stream().good(); if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2 && type != RCTTypeFullBulletproof && type != RCTTypeSimpleBulletproof) return false; if (type == RCTTypeSimpleBulletproof || type == RCTTypeFullBulletproof) @@ -448,7 +448,7 @@ namespace rct { } ar.end_array(); } - return true; + return ar.stream().good(); } }; diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h index 007bf265f..553e9951f 100644 --- a/src/serialization/serialization.h +++ b/src/serialization/serialization.h @@ -212,7 +212,7 @@ inline bool do_serialize(Archive &ar, bool &v) * \brief self-explanatory */ #define END_SERIALIZE() \ - return true; \ + return ar.stream().good(); \ } /*! \macro VALUE(f)