Derby
  1. Derby
  2. DERBY-5036

[patch] fix impossible comparison due to sign extension

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.8.1.2
    • Component/s: Network Server
    • Labels:
      None
    • Urgency:
      Normal
    • Bug behavior facts:
      Deviation from standard

      Description

      code does

      byte b = reader.readByte();
      if (b == 0xF1)
      database.sendTRGDFTRT = true;

      due to sign extension, this test will never be true.

      fixed

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Looks like a bug, yes. Thanks! I'll check in the fix.

        It looks to me like the client driver never passes a TRGDFTRT parameter to the server, so this code doesn't appear to be in use. Does anyone know if support for this codepoint is needed for JCC? (Probably not, otherwise our tests should have detected that the code didn't work back when most of the client/server testing happened against both JCC and the Derby Network Client.) Maybe we should use this opportunity to get rid of some unused and untested code?

        Show
        Knut Anders Hatlen added a comment - Looks like a bug, yes. Thanks! I'll check in the fix. It looks to me like the client driver never passes a TRGDFTRT parameter to the server, so this code doesn't appear to be in use. Does anyone know if support for this codepoint is needed for JCC? (Probably not, otherwise our tests should have detected that the code didn't work back when most of the client/server testing happened against both JCC and the Derby Network Client.) Maybe we should use this opportunity to get rid of some unused and untested code?
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1070676.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1070676.
        Hide
        Knut Anders Hatlen added a comment -

        Marking the issue as resolved since the fix has been committed. If someone thinks the code that handles TRGDFTRT should be removed, we can file a separate JIRA for that.

        In addition to the code handling it in DRDAConnThread.java (look for CodePoint.TRGDFTRT and database.sendTRGDFTRT), there's also a note about it on the client side in NetConnectionReply.java:

        if (peekCP == CodePoint.USRID) {
        // specifies the target defined user ID. It is returned if the value of
        // TRGDFTRT is TRUE in ACCRDB. Right now this driver always sets this
        // value to false so this should never get returned here.
        // if it is returned, it could be considered an error but for now
        // this driver will just skip the bytes.
        [...]

        Show
        Knut Anders Hatlen added a comment - Marking the issue as resolved since the fix has been committed. If someone thinks the code that handles TRGDFTRT should be removed, we can file a separate JIRA for that. In addition to the code handling it in DRDAConnThread.java (look for CodePoint.TRGDFTRT and database.sendTRGDFTRT), there's also a note about it on the client side in NetConnectionReply.java: if (peekCP == CodePoint.USRID) { // specifies the target defined user ID. It is returned if the value of // TRGDFTRT is TRUE in ACCRDB. Right now this driver always sets this // value to false so this should never get returned here. // if it is returned, it could be considered an error but for now // this driver will just skip the bytes. [...]

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Dave Brosius
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development