Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions