NOTE THAT THIS IS A QUESTION ABOUT SECURITY,
NOT A QUESTION ABOUT CODING, please don't answer
if you don’t familiar with it.
Considering the following code (It’s close to Java). Note that
if no value has been associated with k, get(k) returns 0.
double charRatio ( String s , char a ) {
int N = s.length () ;
HashMap counts ;
// suppose at this point counts has been well initialized .
for ( int i = 1 ; i < N; i++) {
char c = s charAt (i ) ;
int v = counts . ge t ( c ) ;
counts . put ( c , v+1);
}
return counts . get ( a )/N;
}
(a)What bugs would you expect a fuzzer(fuzz test) to identify in
this function? Why? (apart from dividing by zero error)
(b) What bugs would be more difficult for a fuzzer to find in
this function?
Why?
NOTE THAT THIS IS A QUESTION ABOUT SECURITY, NOT A QUESTION ABOUT CODING, please don't answer if you don’t familiar with
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am