Question: 6. (18pt) Considering the following code (It's close to Java but indeed, you don't need to know anything about Java in order to solve

6. (18pt) Considering the following code (It's close to Java but indeed,  you don't need to know anything about Java in order to solve 

6. (18pt) Considering the following code (It's close to Java but indeed, you don't need to know anything about Java in order to solve this question). Note that a data structure named HashMap is used. Assume s.length() returns unsigned int. In our case, each entry in counts associates an int value to its key of char type. The value associated with k can be set/updated with put (k, v), and the value associated with the k can be obtained by get (k). Note that if no value has been associated with k, get (k) returns 0. double char Ratio (String s, char a, char b) { int Ns.length(); HashMap counts; // suppose at this point counts has been well initialized. for (i=0; i < N; i++) { char cs.charAt(i); int counts. get (c); counts put (c, v+2); } return (counts. get (a) + 1)/ counts. get (b); } (a) (2pt) Describe how to launch fuzz testing towards this function. (b) (4pt) There is an integer overflow bug. Can you use fuzz testing to detect it? If yes, please explain your approach. If not, please explain why? (c) (4pt) There is a divided by zero bug. Can you use fuzz testing to detect it? Why? (d) (4pt) What bugs would be more difficult for a fuzzer to find in this function? Why?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!