Bad return values from CL-PPCRE

Bug #1576121 reported by Philipp Marek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
Undecided
Unassigned

Bug Description

Short version is: SBCL 1.3.3 on Debian, amd64.

    (print (list
             (cl-ppcre:scan "h" "999" :end 27)
             (cl-ppcre:scan "h" "999" :end 28)
             (cl-ppcre:scan "h" "999" :end 29)
             (cl-ppcre:scan "h" "999" :end 30)
             (cl-ppcre:scan "h" "999" :end nil)
             ))
    (NIL NIL 28 28 72)

ECL and Clisp report errors about index out of range; at least the ":end NIL" call should succeed normally, but say "no match".

Revision history for this message
Attila Lendvai (attila-lendvai) wrote :

FYI, there's this:

https://github.com/edicl/cl-ppcre/issues/26

(cl-ppcre has (safety 0) annotations which is not wise)

Revision history for this message
Stas Boukarev (stassats) wrote :

As Attila said, this due to safety 0, anything can happen.

Changed in sbcl:
status: New → Invalid
Revision history for this message
Philipp Marek (philipp-marek) wrote :

Sorry, but shouldn't the right result come out, regardless of any optimization settings?
When using a too-high index into a string - yeah, that may crash with (safety 0); but ":end NIL" should always work, right?

Isn't that a misoptimization, ie. a bug that should be fixed?

Revision history for this message
Stas Boukarev (stassats) wrote :

What makes you think that :end nil should work?

Revision history for this message
Philipp Marek (philipp-marek) wrote :

Ah, right; the DEFGENERIC has no default values, and the methods all repeat (LENGTH target-string).

Too bad, it would have been easier for a macro that produces calls - especially when using precompiled match functions, which have a mandatory END argument.

Sorry for the noise, I'd hoped for a simpler way ;/

Revision history for this message
Attila Lendvai (attila-lendvai) wrote :

FTR, i've created a PR for this: https://github.com/edicl/cl-ppcre/pull/29

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.