maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #07302
WebScaleSQL: Actually fix all the array bounds warnings
Hi Sergei and Alexey,
during our recent discussion re WebScaleSQL patches we agreed to review $subj:
https://github.com/webscalesql/webscalesql-5.6/commit/094187c4a20e8d0c02f17210da5c80bc0db18f17
All these warnings come from strings/decimal.c. I was able to reproduce them using
gcc-4.8.1, cmake -DBUILD_CONFIG=mysql_release (basically needs -Wall -O3).
I simplified this function to the following:
gcc -Wall -O3 -c dec.c -o dec.o
static const int powers10[2 + 1]= { 1, 10, 100 };
int remove_leading_zeroes(int decimals, int var)
{
decimals%= 2;
while (var < powers10[decimals--]) /* no-op */;
return decimals;
}
The only allowed value for decimals is 1 and var must be > 0. Similar assertion
is enforced by original function.
So far I see nothing wrong with this code. I believe we should skip this patch,
but still we should probably do something about these warning. What's your take?
Regards,
Sergey
Follow ups