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

TCompactProtocol and TJSONProtocol need boundary checking

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9, 0.9.1, 0.9.2
    • Fix Version/s: 0.9.2
    • Component/s: Python - Library
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      On the TCompactProtocol, using i16, i32, i64 there is currently no range checking happening and funky results will happen as makeZigZag will do its best to handle the input. i8 (byte) is effected as it uses pack/unpack which handles the case correctly.

      I wrote a test case for this using i8, i16, i32 and i64 and the result was that the TJSONProtocol is also effected. It instead just took whatever value it was sent regardless of type.

      I then wrote a check_boundary function to raise an exception when feed bad values in a certain bitness. This now raises an exception for both protocols.

      I also further built out the IWriteXX functions for the TJSONProtocol.

        Attachments

          Activity

            People

            • Assignee:
              psi29a Bret Curtis
              Reporter:
              psi29a Bret Curtis
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: