REBOL3 tracker
  0.9.12 beta
Ticket #0001977 User: anonymous

Project:



rss
TypeBug Statuspending Date1-Mar-2013 01:24
Versionalpha 111 CategoryError Handling Submitted bySunanda
PlatformAll Severitycrash Prioritynormal

Summary Function path call with any-string refinement after last declared option can crash console
Description f: func [][return/redo/% 1] f

Problem Event Name:    APPCRASH
Application Name:    r3-gfc51038.exe
Application Version:    0.0.0.0
Application Timestamp:    512d1dca
Fault Module Name:    r3-gfc51038.exe
Fault Module Version:    0.0.0.0
Fault Module Timestamp:    512d1dca
Exception Code:    c0000005
Exception Offset:    00005a20
OS Version:    6.1.7601.2.1.0.768.3
Locale ID:    2057
Additional Information 1:    0a9e
Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
Additional Information 3:    0a9e
Additional Information 4:    0a9e372d3b4ad19135b953a78882e789


Doesn't have to be in a function. This line alone is enough:

return/redo/% 1

DO can show the same fault, if you specify /next:
do/next/% 1 'a
Example code
>> a: func [/b] [1]
>> a/b/%  ;; Crashes the interpreter.

;; ----

>> a: func [/b /c] [1]
>> a/b/%
** Script error: incompatible refinement: %""
>> a/c/%  ;; Crashes the interpreter.

Assigned ton/a Fixed in- Last Update17-Apr-2015 08:08


Comments
(0003551)
BrianH
1-Mar-2013 22:05

Oh, nice find. In order for it to crash these all need to be true:
- A call to any function, not just RETURN or DO, even user functions.
- The function must have at least one refinement, though it can have more.
- The function must be called by a normal path evaluation, not APPLY.
- The function call path must include the last option in its spec, though other options can also be included.
- The bad path element must be of any string type (the file! % you were testing with was just the only such type you could specify directly in normal path syntax).
- The bad path element must be the next element in the path after the final option in the function spec, regardless if there are path elements after the bad element that refer to other function options.

That narrows it down to a bug in Do_Path. RETURN/redo being the first thing you checked was just a coincidence, so I'll change the subject of this ticket accordingly.
(0004383)
abolka
23-Mar-2014 17:06

In the core-tests suite.
(0004488)
szeng
27-Aug-2014 02:02

fixed by:
https://github.com/zsx/r3/commit/72b5d98f68cdd5d4c37bd8eeb7b8b1656c7a8d35
(0004637)
abolka
17-Apr-2015 08:08

Slight variation of Shixin's fix submitted as PR:
https://github.com/rebol/rebol/pull/240

Date User Field Action Change
17-Apr-2015 08:08 abolka Status Modified reviewed => pending
17-Apr-2015 08:08 abolka Comment : 0004637 Added -
17-Apr-2015 08:04 abolka Code Modified -
27-Aug-2014 02:02 szeng Comment : 0004488 Added -
23-Mar-2014 17:06 abolka Comment : 0004383 Added -
1-Mar-2013 22:09 BrianH Summary Modified RETURN/REDO with bad refinement can crash console => Function path call with any-string refinement after last declared option can crash console
1-Mar-2013 22:09 BrianH Description Modified -
1-Mar-2013 22:09 BrianH Code Modified -
1-Mar-2013 22:09 BrianH Version Modified r3 master => alpha 111
1-Mar-2013 22:09 BrianH Status Modified submitted => reviewed
1-Mar-2013 22:05 BrianH Comment : 0003551 Added -
1-Mar-2013 02:15 sunanda Description Modified -
1-Mar-2013 02:15 sunanda Code Modified -
1-Mar-2013 01:24 sunanda Ticket Added -