ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* handle_error_hook in LuaMetaTeX
@ 2020-07-31 16:17 Marcel Fabian Krüger
  2020-08-01 14:11 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Fabian Krüger @ 2020-07-31 16:17 UTC (permalink / raw)
  To: ConTeXt users list

Hi,

thanks for handling
f file consition in LuaMetaTeX. While playing with that, I encountered a
potential bug in the latest LuaMetaTeX version: If handle_error_hook is
executed and returns any number, LuaMetaTeX segfaults. (I'm pretty sure
that this still worked with the previous version) Minimal ConTeXt
example:

\enabledirectives[system.quitonerror=false]
\directlua{
  print(callbacks.register('handle_error_hook', function(...)
    return 3
  end))
}
\undefined % Trigger an error
\starttext
\stoptext

This triggers

[...]
system          > ConTeXt  ver: 2020.07.31 10:20 LMTX  fmt: 2020.7.31  int: english/english
[...]
tex error       > tex error on line 7 in file ./test_empty_input.tex: ! Undefined control sequence

l.7 \undefined
[...]
 9     \stoptext

segmentation fault (core dumped)  /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex    cont-yes.mkiv 

valgrind suggests that this is caused by an attempt to access a null
pointer:

==382632== Invalid write of size 4
==382632==    at 0x1A581F: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1A662F: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x14BAA8: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1DA50E: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1DA802: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x15F956: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x156E2E: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x121E97: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x4A16001: (below main) (in /usr/lib/libc-2.31.so)
==382632==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==382632== 
==382632== 
==382632== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==382632==  Access not within mapped region at address 0x0
==382632==    at 0x1A581F: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1A662F: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x14BAA8: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1DA50E: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x1DA802: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x15F956: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x156E2E: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x121E97: ??? (in /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex)
==382632==    by 0x4A16001: (below main) (in /usr/lib/libc-2.31.so)

That me know if you are interested in the coredump.

Best regards,
Marcel
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: handle_error_hook in LuaMetaTeX
  2020-07-31 16:17 handle_error_hook in LuaMetaTeX Marcel Fabian Krüger
@ 2020-08-01 14:11 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2020-08-01 14:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7/31/2020 6:17 PM, Marcel Fabian Krüger wrote:
> Hi,
> 
> thanks for handling
> f file consition in LuaMetaTeX. While playing with that, I encountered a
> potential bug in the latest LuaMetaTeX version: If handle_error_hook is
> executed and returns any number, LuaMetaTeX segfaults. (I'm pretty sure
> that this still worked with the previous version) Minimal ConTeXt
> example:
> 
> \enabledirectives[system.quitonerror=false]
> \directlua{
>    print(callbacks.register('handle_error_hook', function(...)
>      return 3
>    end))
> }
> \undefined % Trigger an error
> \starttext
> \stoptext
> 
> This triggers
> 
> [...]
> system          > ConTeXt  ver: 2020.07.31 10:20 LMTX  fmt: 2020.7.31  int: english/english
> [...]
> tex error       > tex error on line 7 in file ./test_empty_input.tex: ! Undefined control sequence
> 
> l.7 \undefined
> [...]
>   9     \stoptext
> 
> segmentation fault (core dumped)  /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatex    cont-yes.mki

hm, i don't use that callback myself so i hadn't notice that i swapped 
an argument there; show_error_hook and handle_error_hook now both get an 
argument passed that indicates it it was a runaway error ... an easy fix 
so it should work okay in the next upload

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-01 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 16:17 handle_error_hook in LuaMetaTeX Marcel Fabian Krüger
2020-08-01 14:11 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).