Fork of tomsfastmath for fireswarm
Go to file
Giovanni Bajo c32affe350 Bugfix: fix buffer overflow with comba sqr
The comba sqr code does not check the maximum bounds of fp_int; eg:
if you invoke fp_sqr_comba_20, it will write 40 digits to the
destination even if FP_SIZE < 40. This is correct for achieving high
speeds, but it means that it is the caller's responsibility to check for
such overflows.

fp_sqr.c only checks for numeric overflows (a->used * 2 >= FP_SIZE)
though. This means that if you call fp_sqr() with a small number (say
1), and your FP_SIZE is 10, and you have enabled a fp_sqr_comba_8, it
will overflow your buffer by writing 16 digits.

Since the exact subset of active comba multipliers/sqrs are up to the user
(in tfm.h), we fix the code never to invoke them if they can cause
overflows.
2011-09-20 12:06:44 +02:00
demo added testcase of problem reported by martins.mozeiko@gmail.com 2011-03-27 19:34:36 +02:00
doc added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
mtest added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
pre_gen added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
random_txt_files added tomsfastmath-0.03 2010-07-22 10:06:23 +02:00
src Bugfix: fix buffer overflow with comba sqr 2011-09-20 12:06:44 +02:00
.gitignore added gitignore 2011-03-27 19:33:13 +02:00
changes.txt added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
filter.pl added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
gen.pl added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
genlist.sh added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
LICENSE after multiple objections of libtom users [1], we decided to change licensing 2011-01-19 10:28:48 +01:00
makefile added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
makefile.shared added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
mess.sh added tomsfastmath-0.04 2010-07-22 10:06:24 +02:00
parsenames.pl added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
SPONSORS added tomsfastmath-0.01 2010-07-22 10:06:21 +02:00
tfm.tex added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00
TODO added tomsfastmath-0.10 2010-07-22 10:06:29 +02:00
updatemakes.sh added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00