Re: [NTG-context] handle_error_hook in LuaMetaTeX

2020-08-01 Thread Hans Hagen

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/luametatexcont-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
___


[NTG-context] handle_error_hook in LuaMetaTeX

2020-07-31 Thread Marcel Fabian Krüger
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/luametatexcont-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
___