Skip to content

JavaScript Backend: Fix offset out of bounds panic

Description

This is a real bug in the current backend that occurs by passing an illegal offset to a JS DataView object. We use these objects for Addr# and ByteArrays. It may be possible that this is coming from an incorrectly implemented primop.

Here's an example of the failure:

Wrong exit code for T20509()(expected 0 , actual 2 )
Stdout ( T20509 ):
uncaught exception in Haskell main thread: RangeError: Offset is outside the bounds of the DataView
RangeError: Offset is outside the bounds of the DataView
    at DataView.getInt16 (<anonymous>)
    at h$$37796042 (/run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:1466810:94)
    at h$runThreadSlice (/run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:17472:11)
    at h$runThreadSliceCatch (/run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:17443:12)
    at h$mainLoop (/run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:17438:9)
    at /run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:17899:13
    at h$handleErrnoC (/run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:11785:9)
    at /run/user/1729/ghctest-ars37j8x/test   spaces/testsuite/tests/backpack/cabal/T20509/T20509.run/Setup:11516:13
    at FSReqCallback.oncomplete (node:fs:201:23)
Stderr ( T20509 ):

Impacted tests

Tick these off as they get fixed:

  • T12733 passes
  • T1372 passes
  • T15594 passes
  • T16219 passes
  • T18567 passes
  • T20509 passes
  • T3007 passes
  • different-db passes
  • mhu-closure passes
  • package-imports-20779 passes
  • t19518 passes
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information