planck-repl / planck

Stand-alone ClojureScript REPL
https://planck-repl.org
Eclipse Public License 1.0
1.03k stars 68 forks source link

Build errors under Ubuntu 22.04 #1089

Closed lread closed 2 years ago

lread commented 2 years ago

While looking at #1087, I noticed the following while running script/build -Werror --fast against planck master on Ubuntu 22.04:

In function 'maybe_load_user_file',
    inlined from 'maybe_load_user_file' at /planck/planck-c/engine.c:414:6:
/planck/planck-c/engine.c:418:9: error: 'JSObjectCallAsFunction' reading 8 bytes from a region of size 0 [-Werror=stringop-overread]
  418 |         JSObjectCallAsFunction(ctx, get_function("planck.repl", "maybe-load-user-file"), JSContextGetGlobalObject(ctx),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  419 |                                0, arguments, &ex);
      |                                ~~~~~~~~~~~~~~~~~~
/planck/planck-c/engine.c: In function 'maybe_load_user_file':
/planck/planck-c/engine.c:418:9: note: referencing argument 5 of type 'const struct OpaqueJSValue * const*'

And this note that arguments should be NULL when argumentCount is 0:

arguments A JSValueRef array of arguments to pass to the function. Pass NULL if argumentCount is 0.

And things do pass after correcting this on Ubuntu 22, but still seg fault on Ubuntu 20.

Originally posted by @lread in https://github.com/planck-repl/planck/issues/1087#issuecomment-1101067895

Since Ubuntu 22.04 has been officially released, probably a good idea to address. I'll follow up with a PR.