bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] Integer overflows in gsl_sf_pow_int_e


From: Shaobo He
Subject: [Bug-gsl] Integer overflows in gsl_sf_pow_int_e
Date: Thu, 17 Oct 2019 18:20:43 -0600

Hello everyone,

I noticed an integer overflow issue at line 39 of specfunc/pow_int.c.
Basically, when n is INT_MIN, the negation of n is undefined, which future
causes the right shift operation at line 56 undefined. In reality, having n
being INT_MIN causes non termination. For example, the following program
will loop forever.

```
#include <limits.h>
#include <gsl/gsl_sf_pow_int.h>
#include <assert.h>

int main() {
  assert(gsl_sf_pow_int(1.0, INT_MIN) == 1.0);
  return 0;
}
```

Shaobo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]