Trying to calculate a hash with crypto_data_hash causes SWI session to crash - am I doing something wrong or is this a bug?
joyofdata opened this issue · comments
Hello,
I just wanted to give crypto_data_hash/3
a try but that causes SWI to crash.
use_module(library(crypto)).
crypto_data_hash(test, Hash, [algorithm(sha1)]).
I'm working on Linux Mint 21.2 Xfce 64bit.
And the following documents the session plus error message:
➜ prolog-freecell-solver git:(two-free-cells) swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- use_module(library(crypto)).
true.
?- crypto_data_hash(test, Hash, [algorithm(sha1)]).
SWI-Prolog [thread 1 (main) at Sun Oct 22 14:17:20 2023]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
[0] PL_advance_hash_table_enum() at ??:? [0x7f78f1af8b6a]
[1] Sdprintf() at ??:? [0x7f78f1afda4d]
[2] PL_changed_cwd() at ??:? [0x7f78f1b03cd7]
[3] __restore_rt() at libc_sigaction.c:? [0x7f78f185d520]
[4] EVP_MAC_up_ref() at ??:? [0x7f78f0402074]
[5] ??() at ??:0 [0x7f78f07606c4]
[6] PL_malloc_atomic() at ??:? [0x7f78f1b0e96d]
[7] PL_unify_blob() at ??:? [0x7f78f1b436c8]
[8] PL_unify_blob() at ??:? [0x7f78f1b4356c]
[9] PL_toplevel() at ??:? [0x7f78f1b5ae6f]
[10] swipl(+0x11a5) [0x55ddbdfe31a5]
[11] __libc_start_call_main() at ./csu/../sysdeps/nptl/libc_start_call_main.h:58 [0x7f78f1844d90]
[12] call_init() at ./csu/../csu/libc-start.c:128 [0x7f78f1844e40]
[13] swipl(+0x10c5) [0x55ddbdfe30c5]
Prolog stack:
[12] crypto:_crypto_hash_context_copy/2 [PC=1 in supervisor]
[11] crypto:crypto_data_context/3 [PC=5 in clause 1]
[10] crypto:crypto_data_hash/3 [PC=13 in clause 1]
[9] $toplevel:toplevel_call/1 [PC=3 in clause 1]
[8] $toplevel:stop_backtrace/1 [PC=4 in clause 1]
[7] $tabling:$wfs_call/2 [PC=17 in clause 1]
[5] $toplevel:$execute_goal2/3 [PC=29 in clause 1]
[3] $toplevel:$query_loop/0 [PC=39 in clause 2]
[2] $toplevel:$runtoplevel/0 [PC=19 in clause 1]
[1] $toplevel:$toplevel/0 [PC=3 in clause 1]
[0] system:$c_call_prolog/0 [PC=0 in top query clause]
Running on_halt hooks with status 139
Killing 12793 with default signal handlers
[1] 12793 segmentation fault (core dumped) swipl
Thanks
Raffael
Works fine in the current versions on both Ubuntu and Debian. Possibly they built the old 8.4.2 version against the current crypto libs. I think this should be raised with the mint maintainers.