Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPEND to object of block of odd length can crash #708

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 2 comments
Closed

APPEND to object of block of odd length can crash #708

Siskin-Bot opened this issue Feb 15, 2020 · 2 comments
Labels
CC.resolved Issue with CureCode status built, tested or complete Datatype: object! Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.important Status.important Test.written Type.bug

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: Sunanda

REBOL System Error 1305; invalid data type 83

append make object! [] reduce [a: 'x]

Imported from: CureCode [ Version: alpha 47 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 49 ]
Imported from: metaeducation#708

Comments:

Rebolbot commented on Apr 11, 2009:

Submitted by: BrianH

This is what I get when I enter your code in a fresh console:

bc.. >> append make object! [] reduce [a: 'x]
** Script error: invalid argument: frame!
** Where: append
** Near: append make object! [] [x]

p.

This is the wrong error - there is no frame! in that statement.

On a hunch I next try:

>> append make object! [] [x y z]

...and I get your crash error. This indicates that there is a bounds checking problem when you append a block with an odd number of values in it to an object.

APPEND to an object is supposed to add unset! when just a word! is appended, like this:

>> append make object! [] 'a
== make object! [
    a: unset!
]

Clearly when the value portion is missing from APPEND of [name value], it just tries to use whatever is next in memory instead of assigning unset!. Depending on what is next in memory, that could crash the system or render it corrupt.

Upped the severity and priority accordingly.


Rebolbot added Type.bug and Status.important on Jan 12, 2016


Oldes commented on Feb 9, 2020:

This bug seems to be fixed, although there is different result when using block with word without value, or when used just a word:

>> append make object! [] [x]
== make object! [
    x: none
]

>> append make object! [] 'x
== make object! [
    x: unset!
]

I think that the result should be same... so having none! in the second case too.


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Feb 9, 2020:
FIX: APPEND a word on object should set the value to NONE instead of …


Hostilefork added the Ren.important on Feb 9, 2020


@Siskin-Bot Siskin-Bot added the CC.resolved Issue with CureCode status built, tested or complete label May 22, 2020
@Oldes Oldes closed this as completed May 5, 2021
@Oldes
Copy link
Owner

Oldes commented Sep 23, 2021

When testing #1107 I realized, that both values should be unset! and not none! as I did.

@Oldes Oldes reopened this Sep 23, 2021
Oldes added a commit to Oldes/Rebol3 that referenced this issue Sep 23, 2021
@Oldes
Copy link
Owner

Oldes commented Sep 23, 2021

Now it is:

>> append make object! [] [x]
== make object! [
    x: unset!
]

>> append make object! [] 'x
== make object! [
    x: unset!
]

@Oldes Oldes closed this as completed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CC.resolved Issue with CureCode status built, tested or complete Datatype: object! Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.important Status.important Test.written Type.bug
Projects
None yet
Development

No branches or pull requests

2 participants