Uploaded image for project: 'Clojure'
  1. CLJ-962

Vectors returned by subvec allow access at negative indices

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: Release 1.5
    • Labels:
      None
    • Approval:
      Ok
    • Patch:
      Code and Test

      Description

      Google group thread: https://mail.google.com/mail/?shva=1#label/clojure/1365e058eaf0d5fa

      Vectors returned by subvec correctly disallow access to elements after their end, but not before their beginning.

      Clojure 1.3.0
      user=> (def v1 (vec (range 100)))
      #'user/v1
      user=> (def v2 (subvec v1 50 52))
      #'user/v2
      user=> (v2 3)
      IndexOutOfBoundsException clojure.lang.APersistentVector$SubVector.nth (APersistentVector.java:526)
      user=> (v2 -48)
      2

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jafingerhut Andy Fingerhut
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: