Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4563

TBinaryProtocol exits at first 0 or "/x00" byte.

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Closed
    • Priority: Minor
    • Resolution: Information Provided
    • Affects Version/s: 0.11.0
    • Fix Version/s: None
    • Component/s: Python - Library
    • Labels:
      None
    • Environment:

      python3.6

      Description

      Tried to deserialize binary file using deserialize function in thrift.TSerialization.py file. Used TBinaryProtocol and thrift file created by Java developer. Generated ttypes.py have while loop that runs till break if byte=0.

      while True:
                  (fname, ftype, fid) = iprot.readFieldBegin()
                  if ftype == TType.STOP:
                      break
                  if fid == 1:
                      if ftype == TType.I64:
                          self.sessionId = iprot.readI64()
                      else:
                          iprot.skip(ftype)

                   ...

      As far as I understood protocol cannot have 0 byte and breaks when first 0 appears. Seems as a bug for me! Isn't there more advanced way to check for the end of file?
       
       
       

        Attachments

          Activity

            People

            • Assignee:
              jking3 James E. King III
              Reporter:
              yerzhan Yerzhan Kaskabay
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: