• When decoding base64 encoded strings padded with trailing '=' the '=' seem to get replaced with \x00:

    x = btoa('H')     // "SA=="
    atob(x)           // "H\x00\x00"
    x = btoa('Ha')    // "SGE="
    atob(x)           // "Ha\x00"
    x = btoa('Hal')   // "SGFs"
    atob(x)           // "Hal"
    

    Looks like a glitch in the base64 decoder?

  • Wow, thanks - I have no idea how that didn't get spotted.

    I've just put a fix in, so the latest xcutting edge builds should have this fixed

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Base64 decoding (atob) of padded strings yields trailing \x00

Posted by Avatar for Steffen @Steffen

Actions