Derby
  1. Derby
  2. DERBY-3941

Unsafe use of DataInput.skipBytes() in StoredPage and StoredFieldHeader

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.6.1.0
    • Component/s: Store
    • Labels:
      None
    • Issue & fix info:
      Newcomer

      Description

      Some methods in StoredFileHeader and StoredPage call java.io.DataInput.skipBytes(int) with the assumption that it always skips the requested number of bytes. According to the javadoc for skipBytes, it may skip fewer bytes than requested, possibly 0, even if the end of the stream hasn't been reached.

      The problem exists in these methods:

      StoredFieldHeader.readFieldDataLength()
      StoredPage.readRecordFromStream()
      StoredPage.skipField()
      StoredPage.readOneColumnFromPage()
      StoredPage.readRecordFromArray()

      We should change the code so that it works correctly even if skipBytes() were to skip fewer bytes than requested.

      1. derby-3941-1.diff
        13 kB
        Yun Lee
      2. derby-3941-1.stat
        0.4 kB
        Yun Lee
      3. derby-3941-2.diff
        14 kB
        Yun Lee
      4. derby-3941-2.stat
        0.5 kB
        Yun Lee
      5. derby-3941-3.diff
        14 kB
        Yun Lee
      6. derby-3941-3.stat
        0.5 kB
        Yun Lee
      7. derby-3941-4.diff
        12 kB
        Yun Lee
      8. derby-3941-4.stat
        0.5 kB
        Yun Lee
      9. derby-3941-5.diff
        4 kB
        Yun Lee
      10. derby-3941-5.stat
        0.1 kB
        Yun Lee

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12445811 ] Default workflow, editable Closed status [ 12801642 ]
          Dag H. Wanvik made changes -
          Issue & fix info [Newcomer]
          Dag H. Wanvik made changes -
          Component/s Newcomer [ 12310640 ]
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Closed [ 6 ]
          Derby Info [Patch Available]
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Resolution Fixed [ 1 ]
          Yun Lee made changes -
          Derby Info [Patch Available]
          Yun Lee made changes -
          Attachment derby-3941-5.diff [ 12405651 ]
          Attachment derby-3941-5.stat [ 12405652 ]
          Yun Lee made changes -
          Attachment derby-3941-4.diff [ 12405649 ]
          Attachment derby-3941-4.stat [ 12405650 ]
          Yun Lee made changes -
          Attachment derby-3941-3.diff [ 12405317 ]
          Attachment derby-3941-3.stat [ 12405318 ]
          Yun Lee made changes -
          Attachment derby-3941-2.diff [ 12405270 ]
          Attachment derby-3941-2.stat [ 12405271 ]
          Yun Lee made changes -
          Attachment derby-3941-1.diff [ 12405222 ]
          Attachment derby-3941-1.stat [ 12405223 ]
          Yun Lee made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Yun Lee made changes -
          Assignee Yun Lee [ yunlee ]
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Link This issue is related to DERBY-3770 [ DERBY-3770 ]
          Knut Anders Hatlen created issue -

            People

            • Assignee:
              Yun Lee
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development