sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 473 forks source link

Fix overflow error in hyperbolicity #14351

Closed dcoudert closed 11 years ago

dcoudert commented 11 years ago

This patch solves an overflow error caused by the assignment of a negative value to an unsigned int.

CC: @nathanncohen

Component: graph theory

Author: David Coudert

Reviewer: Nathann Cohen

Merged: sage-5.9.beta2

Issue created by migration from https://trac.sagemath.org/ticket/14351

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 11 years ago
comment:2

You replace

(j<jmax)

by

(j<jmax and jmax>0)

but as jmax is already larger than j (which is an unsigned integer) then jmax is nonzero. And the same goes for the second test you add. If it makes a difference I don't see how O_o

Nathann

dcoudert commented 11 years ago

Attachment: trac_14351.patch.gz

dcoudert commented 11 years ago
comment:3

right, I added too much tests. I have attached the good and simple version.

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 11 years ago

Reviewer: Nathann Cohen

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 11 years ago
comment:4

Ahahaha. If you say that it happens... Looks weird, but it's correct indeed ;-)

Nathann

jdemeyer commented 11 years ago

Merged: sage-5.9.beta2