GaloisInc / daedalus

The Daedalus data description language
BSD 3-Clause "New" or "Revised" License
63 stars 11 forks source link

html code point range error #368

Open kquick opened 1 month ago

kquick commented 1 month ago

My specification contains: offsets = Many 4 UInt32. When I use daedalus run it decodes correctly and I'm seeing:

...
   offsets: [ 4194304[32]
                 , 0[32]
                 , 16384[32]
                 , 0[32]
                 ]
...

but I get a blank window when trying to load HTML generated with the --traced-values --html arguments. The browser console has an error:

Uncaught RangeError: 4194304 is not a valid code point
    renderArray file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:846
    renderValueUntraced file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1047
    renderValue file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:985
    renderStruct file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:781
    renderValueUntraced file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1087
    renderValue file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:985
    renderStruct file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:781
    renderValueUntraced file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1087
    renderValue file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:985
    renderStruct file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:781
    renderValueUntraced file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1087
    renderValue file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:985
    renderStruct file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:781
    renderValueUntraced file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1087
    renderValue file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:985
    main file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:553
    onload file:///home/kquick/work/DFAMS/daedalus/p6_cil.html:1

I believe it's trying to convert the value to a string, and a UInt32 might be a UTF-32 code point, but in this case, it's not a valid code point, thus this exception and with no error handling for this, the entire document is not rendered.

kquick commented 1 month ago

Firefox provided a "learn more" button linking to the following regarding the error: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_valid_code_point