Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-13810

[C++][Compute] Predicate IsAsciiCharacter allows invalid types and values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 6.0.0
    • C++

    Description

      The IsAsciiCharacter predicate has a template type for its input parameter but it only checks if the value is less than 128. This check is unbounded in its lower bound, so it is prone to receive non-ASCII characters (negative value) and return true. There are three solutions in order of my preference:

      1. Remove the template and make the type uint8_t. All its use cases use uint8_t and this is the type used across the ASCII operations. Also, the other string-related utility functions are not templates.
      2. Constrain the template so that it only accepts unsigned integers.
      3. Add a check to validate that argument is non-negative. This check adds unnecessary overhead.

      Attachments

        Issue Links

          Activity

            People

              edponce Eduardo Ponce
              edponce Eduardo Ponce
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m