lidavidm commented on issue #36476:
URL: https://github.com/apache/arrow/issues/36476#issuecomment-1621944476

   > which is encoded "in zero bytes" in Protobuf via the field tag
   
   Scratch that, I misremembered (maybe Thrift does that?)
   
   Protobuf bools are integers, so they should always be 0 or 1. And the 
serialization code is all in headers, and are inlinable. So I suppose what 
happens is this code:
   
   ```cpp
   inline uint8_t* WireFormatLite::WriteBoolNoTagToArray(bool value,
                                                         uint8_t* target) {
     return io::CodedOutputStream::WriteVarint32ToArray(value ? 1 : 0, target);
   }
   ```
   
   gets optimized to something like 
   
   ```cpp
   inline uint8_t* WireFormatLite::WriteBoolNoTagToArray(bool value,
                                                         uint8_t* target) {
     return 
io::CodedOutputStream::WriteVarint32ToArray(static_cast<int32_t>(value), 
target);
   }
   ```
   
   and then an uninitialized boolean value will get dumped to the wire as an 
invalid Protobuf.


-- 
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]

Reply via email to