1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

Fix non-deterministic crash in 'finalization_thread_proc'.

Fixes <https://bugs.gnu.org/37757>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

* libguile/finalizers.c (finalization_thread_proc): Do not enter the
"switch (data.byte)" condition when data.n <= 0.
This commit is contained in:
Ludovic Courtès 2019-12-09 14:44:59 +01:00
parent 659526d33b
commit edf5aea7ac

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2012, 2013, 2014 Free Software Foundation, Inc. /* Copyright (C) 2012, 2013, 2014, 2019 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -211,21 +211,26 @@ finalization_thread_proc (void *unused)
scm_without_guile (read_finalization_pipe_data, &data); scm_without_guile (read_finalization_pipe_data, &data);
if (data.n <= 0 && data.err != EINTR) if (data.n <= 0)
{ {
perror ("error in finalization thread"); if (data.err != EINTR)
return NULL; {
perror ("error in finalization thread");
return NULL;
}
} }
else
switch (data.byte)
{ {
case 0: switch (data.byte)
scm_run_finalizers (); {
break; case 0:
case 1: scm_run_finalizers ();
return NULL; break;
default: case 1:
abort (); return NULL;
default:
abort ();
}
} }
} }
} }