Open rebolbot opened 15 years ago
Submitted by: Carl
This needs some discussion, because APPEND of an existing word is actually a SET not an APPEND.
There are a few possible ways to handle this situation. I've marked this bug as 'problem to discuss it in more detail.
Submitted by: Sunanda
Here is an example of a system crash (assertion failure 1207) generated by using this bug as an exploit to poison/overflow system/contexts/user
repeat n 5000 [
print n
collect-words words-of system/contexts/user
foreach w words-of system/contexts/user [protect/hide w]
]
I see the failure occurring around iteration 2430....That is not enough words to overflow the word limit (somewhere else said to by around the 450,000 mark).
Submitted by: Carl
As mentioned above, APPEND (EXTEND) using an existing word is a SET, not an extension of the object. SET requires a BIND, but we are not allowed to bind to hidden fields, and attempting to do so will throw an error.
Submitted by: BrianH
That sounds good. We should do that. The current behavior of APPEND extending the object (as shown in the code) is not good.
Submitted by: BrianH
When you PROTECT/hide a word in an object, appending another word of that name is supposed to create a new binding entry of that name. Then, in theory, subsequent bindings to the object are supposed to access the new field, as if the old field didn't exist. Except they don't: Those overrides are currently inaccessible. Even to APPEND, which can't tell that the field has been overridden and tries to override it again.
I'm not sure that allowing appends of previously hidden words to override the old word for new bindings is a good idea (it would probably break the module security model). However, the current behavior is really bad, or at least awkward and ugly: See the code for details.
This seems like something that needs tweaking.
CC - Data [ Version: alpha 76 Type: Issue Platform: All Category: Security Reproduce: Always Fixed-in:alpha 79 ]