swipl crashes when handling uninitialized pl functor (through CFFI)
Haitao Zhang <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFUyvhqHq+kHj0ooKqoR3hmTLdJ=TuNBHXf_iOCU9Vu-=2hYNw@mail.gmail.com> |
It was a mistake on my part as I forgot to initialize some functor_t
variables. When PL_unify_term is called on the uninitialized functor the
whole program crashes. I am using swi 6.4.1 on a Windows 8 machine.
This is not a big deal as it was a bug on my part in the first place but I
thought it may be worth reporting as crashing may not be the best response
here:-) Here is the first part of the stack trace:
%@ Stack trace labeled "crash":
%@ [0] <c:\Program
Files\swipl\bin\libswipl.dll>:PL_unify_functor+000000007020D39C
%@ [1] <c:\Program
Files\swipl\bin\libswipl.dll>:PL_warning+000000007020BB9D
%@ [2] <c:\Program
Files\swipl\bin\libswipl.dll>:PL_unify_term+000000007020BFF2
I believe it is in response to a call like this:
PL_unify_term(t_node_literal,
PL_FUNCTOR, FUNCTOR_literal1,
PL_TERM, t_node)
with the FUNCTOR_literal1 being either uninitialized or garbage collected
between foreign calls.
Incidentally what is the best way to keep a term like FUNCTOR_literal1 that
is really a constant across foreign calls?
Haitao
-------------- next part --------------
HTML attachment scrubbed and removed