REBOL3 tracker
  0.9.12 beta
Ticket #0000341 User: anonymous

Project:



rss
TypeBug Statustested Date30-Sep-2007 20:31
Versionalpha 31 CategoryUnspecified Submitted byJerry
PlatformAll Severityminor Priorityhigh

Summary ALIAS allows word! for its name argument
Description When the second augument is word!, instead of string!
>> alias 'print 'pnt
== pnt
>> pnt 1
** Script error: pnt has no value

The word! type should be disallowed for the name argument.
Example code

			

Assigned ton/a Fixed inalpha 79 Last Update31-Jan-2011 06:15


Comments
(0000187)
admin
12-Jan-2008 10:58

R2 only allows a string for the second arg; R3 should probably do the same (not knowing if there are other issues in allowing words). --Gregg

There is definitely an issue with allowing words: If even a set-word! version of a word is loaded, that word can't be used as an alias. Specifying the 'pnt in the example statement loads the word pnt, making it unavailable for alias. The word! datatype needs to be disallowed for the name parameter.
-BrianH
(0001004)
Carl
21-Jun-2009 00:29

ALIAS works, but words belong to namespaces in R3, different from R2.

>> alias 'print 'pt
== pt
>> 'pt = 'print
== true

>> system/contexts/exports/pt ["example" 1]
example 1
(0001447)
BrianH
31-Jul-2009 21:39

See #1164 for examples of why this is still a bug, and #1163 and #1165 for related bugs.

I understand that ALIAS is probably used to implement case-preserving words in R3, and thus needs to accept a word argument. However, as a user-space function this can cause major problems.

It would be a better idea to have an internal function that does the aliasing for case preserving and such (called by MAKE/TO word!), and a user-level function that only allows words that aren't yet in the symbol table (case-insensitive) to be aliased. The restriction of string! for the second argument would need to be restored for the user-level function.

The alternative would have to be either security-restricting ALIAS, or not exporting it at all.
(0001557)
BrianH
21-Aug-2009 20:15

As of alpha 79, ALIAS no longer allows a word for its name argument. However, it does not check to see if the name word has been used yet. This means that #1163, #1164 and #1165 can still occur, though are now less likely to do so.

The problem is that ALIAS probably can't check to see if a word has been used yet since there is no direct connection between a word being loaded and being used. In R2, loading a word meant putting it into system/words, which counted as use, so you could block ALIAS for existing words. In R3, ALIAS is used to implement case-preserving words, and you can *guarantee* that the word has been used in that case, every time.

With ALIAS word! word! disabled, #1163 and #1165 are less important, but the previously dismissed #1164 now becomes a security issue. ALIAS needs to be used carefully, or it could inadvertantly be used as a denial-of-service attack.

Created a ticket for the security issue (#1212).
(0003068)
BrianH
31-Jan-2011 06:15

As of alpha 111, the ALIAS function has been removed, so the above issues have been resolved.

Date User Field Action Change
31-Jan-2011 06:15 BrianH Comment : 0003068 Added -
21-Aug-2009 22:03 BrianH Comment : 0001557 Modified -
21-Aug-2009 20:15 BrianH Comment : 0001557 Added -
21-Aug-2009 19:45 BrianH Status Modified dismissed => tested
21-Aug-2009 19:45 BrianH Severity Modified not a bug => minor
21-Aug-2009 19:45 BrianH Category Modified => Unspecified
21-Aug-2009 19:45 BrianH Fixedin Modified => alpha 79
1-Aug-2009 00:17 BrianH Comment : 0001447 Modified -
1-Aug-2009 00:14 BrianH Comment : 0001447 Modified -
31-Jul-2009 21:39 BrianH Comment : 0001447 Added -
21-Jun-2009 00:30 carl Comment : 0001004 Modified -
21-Jun-2009 00:29 carl Comment : 0001004 Added -
21-Jun-2009 00:21 carl Status Modified reviewed => dismissed
21-Jun-2009 00:21 carl Severity Modified trivial => not a bug
26-Feb-2009 08:01 BrianH Priority Modified normal => high
20-Jan-2009 01:23 BrianH Priority Modified none => normal
20-Jan-2009 01:23 BrianH Version Modified => alpha 31
20-Jan-2009 01:23 BrianH Description Modified -
20-Jan-2009 01:23 BrianH Summary Modified Alias not working => ALIAS allows word! for its name argument
2-Dec-2008 18:50 Admin Ticket Added -