Date: Tue, 25 Mar 2025 19:26:18 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 285658] [PATCH] SIGFPE in /usr/bin/primes Message-ID: <bug-285658-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285658 Bug ID: 285658 Summary: [PATCH] SIGFPE in /usr/bin/primes Product: Base System Version: 13.5-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: mfp49_freebsd@plass-family.net Created attachment 259027 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=259027&action=edit Fix crash in /usr/bin/primes Here is one example: $ /usr/bin/primes 5000000000 5000000099 Floating point exception $ I tracked down the problem to the do-while loop in src/usr.bin/primes/primes.c, which can run beyond the end of the primes[] array when fact_lim >= *pr_limit; in my case the fetched value is zero, leading to an integer divide-by-zero. This bug appears to be quite old. Possibly it has been masked by the presence of non-zero memory after the primes array. A patch (against CURRENT) is attached. -- You are receiving this mail because: You are the assignee for the bug.help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-285658-227>
