metaeducation/ren-c

Unsafe Error: TRANSCODE of arbitrary binary

Closed this issue · 8 comments

In ReplPad, this gives an unsafe error:

>> transcode #{DECAFBAD}
** UNSAFE ERROR ENCOUNTERED IN CONSOLE SKIN
** REVERTING TO DEFAULT SKIN
** HOST-CONSOLE ACTION! ITSELF RAISED ERROR
** SAFE RECOVERY NOT LIKELY, BUT TRYING ANYWAY
** REVERTING TO DEFAULT SKIN
[#host-console-error]
** Script Error: invalid UTF-8 byte sequence found during decoding
** Where: mold then if if ext-console-impl entrap main
** Near: [***
    print mold prior **
]
** Line: 307

I suspect it should be some kind of syntax or UTF-8 error.

In older builds (this one built 30-Jul-2020), the interpreter bombs:

>> transcode #{DECAFBAD}
Assertion failed: (utf8 != NULL), function Hash_UTF8, file ../src/core/s-crc.c, line 154.
Abort trap: 6

And R3C branch:

>> transcode #{DECAFBAD}
Segmentation fault: 11

R3-Alpha didn't validate word scans for UTF8, it just said "oh this byte sequence looks like a word" and interned it.

r3-alpha>> type? first transcode #{DECAFBAD}
== word!

So this is all part of the slow process of Ren-C speaking up when noticing something is wrong. Good news is that there's distinct datatypes now for "validated utf8 byte sequence" and "not yet validated utf8 byte sequence". If that datatype had been honored here, it wouldn't have been able to compile the code that assumed the sequence was checked when it wasn't.

Fixed now: 77f61f7

@hostilefork I don't know if it was this fix, but ReplPad isn't booting now

Boots for me in Chrome, Edge, and Firefox...and passed the greenlight test on the build server (headless firefox)

Tested on Firefox and Chrome—shows the usual whirr of text then goes blank showing only the yellow sticky.

Screen Shot

What does the JavaScript console say? What is the git commit in the lib-r3.js file in the network tab? (Console should print that, too)

Make sure you don't have files cached. If the .reb files are cached, they can be stale. Ctrl-Shift-R for full refresh, or whatever.

Hm, turned on the panel in Chrome and it loaded. Must be caching—tried force refreshing, I guess it didn't take. In Firefox:

console

Ok, cleared cache, is working.