public inbox for trinity@vger.kernel.org
 help / color / mirror / Atom feed
* divide by zero in random/taviso()
@ 2014-01-17 20:21 Vince Weaver
  2014-01-17 20:41 ` [patch] fix " Vince Weaver
  0 siblings, 1 reply; 5+ messages in thread
From: Vince Weaver @ 2014-01-17 20:21 UTC (permalink / raw)
  To: trinity

Hello

so for my perf_fuzzer I re-use the trinity random.c, and today I hit

[ 1241.026870] traps: perf_fuzzer[4509] trap divide error ip:40a779 

which maps to the taviso() routine which is doing:

           case 1: r = rand() % rand();
#if __WORDSIZE == 64
                r <<= 32;
                r |= rand() % rand();
#endif
                break;

which is a divide by zero if rand() returns 0.

Is there a good way to fix this short of a lot of special case checks?

Vince Weaver
vincent.weaver@maine.edu
http://www.eece.maine.edu/~vweaver/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-21 19:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 20:21 divide by zero in random/taviso() Vince Weaver
2014-01-17 20:41 ` [patch] fix " Vince Weaver
2014-01-17 21:03   ` Dave Jones
     [not found]     ` <CAKB9nXvQmAU-PXjqbezf7G5bWfrjMTD5LjoFnj98K8Tyy5eQ2Q@mail.gmail.com>
2014-01-21 19:07       ` Dave Jones
2014-01-21 19:47         ` Vince Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox