Subject: | Segfault on AIX with statements that have placeholders |
If you build DBD::Pg on AIX, it'll segfault in the pow() calls under
some circumstances in dbd_st_prepare_statement. Apparently there are
two separate pow() functions in different libraries on AIX -- one
takes int arguments, the other takes double arguments.
The following patch switches to use powf() instead of pow(). Given
that it's always pow(10,x), where 1<=x<=7, a lookup table'd probably
be faster, but I'm not picturing this function call being much of a
speed issue. (I don't know if powf() is everywhere, so it may be more
portable)
--- dbdimp.c~ Wed May 3 22:11:14 2006
+++ dbdimp.c Thu Jan 25 10:57:53 2007
@@ -1503,7 +1503,7 @@
continue;
/* The parameter itself: dollar sign plus digit
(s) */
for (x=1; x<7; x++) {
- if (currseg->placeholder < pow((double)
10,(double)x))
+ if (currseg->placeholder < powf((float)
10,(float)x))
break;
}
if (x>=7)
@@ -2081,7 +2081,7 @@
continue;
/* The parameter itself: dollar sign
plus digit(s) */
for (x=1; x<7; x++) {
- if (currseg->placeholder < pow
((double)10,(double)x))
+ if (currseg->placeholder < powf
((float)10,(float)x))
break;
}
if (x>=7)