wwbmmm commented on code in PR #3576:
URL: https://github.com/apache/brpc/pull/3576#discussion_r4153497244


##########
src/mcpack2pb/parser.cpp:
##########
@@ -299,24 +306,24 @@ int64_t UnparsedValue::as_int64(const char* var) {
         if (value <= (uint64_t)std::numeric_limits<int64_t>::max()) {
             return (int64_t)value;
         }
-        CHECK(false) << "uint64=" << value << " to " << var << " overflows";
+        LOG(ERROR) << "uint64=" << value << " to " << var << " overflows";
         _stream->set_bad();
         return std::numeric_limits<int64_t>::max();
     }
     case PRIMITIVE_FIELD_BOOL:
         return _stream->cut_packed_pod<bool>();
     case PRIMITIVE_FIELD_FLOAT:
-        CHECK(false) << "Can't set float=" << _stream->cut_packed_pod<float>()
+        LOG(ERROR) << "Can't set float=" << _stream->cut_packed_pod<float>()
                      << " to " << var;
         _stream->set_bad();
         return 0;
     case PRIMITIVE_FIELD_DOUBLE:
-        CHECK(false) << "Can't set double=" << 
_stream->cut_packed_pod<double>()
+        LOG(ERROR) << "Can't set double=" << _stream->cut_packed_pod<double>()
                      << " to " << var;
         _stream->set_bad();

Review Comment:
   [replied by brpc-oncall robot] This finding is fixed in b0573d2e: the 
value-returning `cut_packed_pod<T>()` in `src/mcpack2pb/parser-inl.h` now 
zero-initializes its result and, on a short read, returns a zero value and 
marks the stream bad (the latest review confirms approval with only this stale 
thread still open, since the diff hunk it anchors to in `parser.cpp` was not 
touched by the fix). Regression tests `Int32FieldTruncatedPayloadIsRejected` 
and `FloatFieldTruncatedPayloadIsRejected` cover it. Could you resolve the 
thread?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to