SEGV Crash in `numerator(f(t)/g(t)-const)`

52 views
Skip to first unread message

Georgi Guninski

unread,
May 11, 2024, 12:58:38 PMMay 11
to sage-...@googlegroups.com
The following hurt my computations.

```
#Author Georgi Guninski, Sat May 11 04:53:23 PM UTC 2024
p=101;
Kt.<t>=Integers(p)[]
c5,s5=((100*t^10 + 45*t^8 + 93*t^6 + 8*t^4 + 56*t^2 + 1)/(t^10 + 5*t^8
+ 10*t^6 + 10*t^4 + 5*t^2 + 1), (10*t^9 + 82*t^7 + 50*t^5 + 82*t^3 +
10*t)/(t^10 + 5*t^8 + 10*t^6 + 10*t^4 + 5*t^2 + 1))
f1=numerator(c5+99/101);f2=numerator(s5-20/101)
print("Done",f1,f2)
```
Unhandled SIGSEGV: A segmentation fault occurred

Nils Bruin

unread,
May 11, 2024, 2:12:43 PMMay 11
to sage-devel
The system should of course not segfault on this, but I doubt that this fault kept you from getting a valid result. The fractions 99/101 and 20/101 cannot be coerced into Kt. So the problem is probably that for convenience the system pretends there is a coercion map Q -> GF(101), but it's actually only a partial map. It may be as simple as an uncaught exception (because the code didn't expect an exception to occur here.

To work around this bug, coerce your constants into Kt before doing the arithmetic:

 f1=numerator(c5+Kt(99/101));f2=numerator(s5-Kt(20/101))

That will give you an appropriate error instead of a segfault.


Georgi Guninski

unread,
May 12, 2024, 2:23:31 AMMay 12
to sage-...@googlegroups.com
I see your point, but segafault should be avoided if possible.
In some cases it is considered denial of service and IIRC on Fedora
the coredump is in /var, owned by root and not deletable by user.
Reply all
Reply to author
Forward
0 new messages