Skip to content

Silent on Little-Endian Bug #4109

@JReynolds-00

Description

@JReynolds-00

There is a latent bug that only appears when attempting to run prism on Big-Endian architecture. There is a typo where uint8 was replaced with uInt8 at file path templates/javascript/src/deserialize.js.erb

const LITTLE_ENDIAN = (() => {
  let uint32 = new Uint32Array([0x11223344]);
  let uint8 = new Uint8Array(uint32.buffer);

  if (uint8[0] === 0x44) {
    return true;
  } else if (uInt8[0] === 0x11) {        // this is the issue, should be 'uint8'
    return false;
  } else {
    throw new Error("Mixed endianness");
  }
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions