Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-43057 Deprecated utils.FormattedText, Web, Validator => api.FormattedText
  3. SAK-43459

Bug: Bad comparison of signed byte with 128 in org.sakaiproject.util.impl.FormattedTextImpl.escapeUrl(String)

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: OPEN
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 11.4, 19.3
    • Fix Version/s: None
    • Component/s: Kernel
    • Labels:
      None
    • Test Plan:

      Description

      Bug: Bad comparison of signed byte with 128 in org.sakaiproject.util.impl.FormattedTextImpl.escapeUrl(String)

      Signed bytes can only have a value in the range -128 to 127. Comparing a signed byte with a value outside that range is vacuous and likely to be incorrect. To convert a signed byte
      b to an unsigned value in the range 0..255, use
      0xff & b.

      Rank: Scariest (4),
      confidence: Normal

      Pattern: INT_BAD_COMPARISON_WITH_SIGNED_BYTE

      Type: INT,
      Category: CORRECTNESS (Correctness)<hr size="1" />

      XML output:
      <BugInstance type="INT_BAD_COMPARISON_WITH_SIGNED_BYTE" priority="2" rank="4" abbrev="INT" category="CORRECTNESS" first="1"> <Class classname="org.sakaiproject.util.impl.FormattedTextImpl"> <SourceLine classname="org.sakaiproject.util.impl.FormattedTextImpl" sourcefile="FormattedTextImpl.java" sourcepath="org/sakaiproject/util/impl/FormattedTextImpl.java"/> </Class> <Method classname="org.sakaiproject.util.impl.FormattedTextImpl" name="escapeUrl" signature="(Ljava/lang/String;)Ljava/lang/String;" isStatic="false"> <SourceLine classname="org.sakaiproject.util.impl.FormattedTextImpl" start="1107" end="1145" startBytecode="0" endBytecode="431" sourcefile="FormattedTextImpl.java" sourcepath="org/sakaiproject/util/impl/FormattedTextImpl.java"/> </Method> <Int value="128" role="INT_VALUE"/> <LocalVariable name="b" register="5" pc="115" role="LOCAL_VARIABLE_NAMED"/> <SourceLine classname="org.sakaiproject.util.impl.FormattedTextImpl" start="1128" end="1128" startBytecode="115" endBytecode="115" sourcefile="FormattedTextImpl.java" sourcepath="org/sakaiproject/util/impl/FormattedTextImpl.java"/> <SourceLine classname="org.sakaiproject.util.impl.FormattedTextImpl" start="1128" end="1128" startBytecode="115" endBytecode="115" sourcefile="FormattedTextImpl.java" sourcepath="org/sakaiproject/util/impl/FormattedTextImpl.java"/> </BugInstance> <hr size="1" />

      At FormattedTextImpl.java:[line 1128]
      In method org.sakaiproject.util.impl.FormattedTextImpl.escapeUrl(String)
      Value 128
      Local variable named b

      File: /home/dhorwitz/git/sakai/kernel/kernel-impl/src/main/java/org/sakaiproject/util/impl/FormattedTextImpl.java

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                • Assignee:
                  dhorwitz David Horwitz
                  Reporter:
                  dhorwitz David Horwitz
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Git Integration