<i>tclStrToD can fail with -ftrapv compiler option</i> status still Open with 3 other changes
by
.
D 2023-08-15T07:26:51.288
J icomment I\sam\snot\scertain\swhich\soperation\soverflowed\shere.\s<tt>c\s-\s'0'</tt>\sonly\soverflows\swhen\s<tt>c\s<\s-0x50</tt>.\sIf\s<tt>isdigit(UCHAR(c))</tt>\sis\strue,\sthen\s<tt>c</tt>\sis\sbetween\s<tt>0x30</tt>\sand\s<tt>0x39</tt>,\sso\s<tt>c\s-\s'0'</tt>\scannot\soverflow.\sSomething\selse\sseems\swrong.\sI\sdo\snot\sknow\sif\sdeclaring\s<tt>c</tt>\sas\s<tt>unsigned\schar</tt>\s(since\s<tt>char</tt>\sis\ssigned\sby\sdefault\son\sDarwin\samd64)\sto\savoid\sthe\s<tt>-ftrapv</tt>\sexception\sis\sa\sgood\sidea\sor\sjust\shides\sthe\sproblem.\sBut\sI\shave\snot\sspotted\sany\srelevant\schanges\ssince\sthis\sissue\swas\sreported\swhich\smay\shave\sresolved\sit.\r\n\r\nSo\sfar\sI\scannot\sreproduce\sthis\sissue\swith\seither\s<tt>-ftrapv</tt>\sor\s<tt>-fsanitize=signed-integer-overflow</tt>\swhen\sI\srun\sthese\sexamples.
J login chrstphrchvz
J mimetype text/x-fossil-wiki
K 3d3124d01dabb46584e39877d44802bf5e8f4952
U chrstphrchvz
Z 091c2bd2b2dee8b24e5003be23879fea