Skip to content

Conversation

@YuShuanHsieh
Copy link
Contributor

No description provided.

@YuShuanHsieh YuShuanHsieh requested a review from jserv January 28, 2020 14:16
@YuShuanHsieh YuShuanHsieh force-pushed the feature/random-string branch from e3f79ea to aa43954 Compare January 28, 2020 15:08
@YuShuanHsieh YuShuanHsieh force-pushed the feature/random-string branch from aa43954 to aee0b75 Compare January 29, 2020 00:11
@jserv
Copy link
Contributor

jserv commented Jan 29, 2020

The subject of git commit messages was inaccurate. It can be "Recognize 'RAND' parameter for insertions."

static void fill_rand_string(char *buf, size_t buf_size)
{
size_t len = 0;
while (len < MIN_RANDSTR_LEN)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if buf_size < MIN_RANDSTR_LEN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good question. But I think the function is for internal usage and both buf_size and minimum length are defined by MIN_RANDSTR_LEN and MAX_RANDSTR_LEN. So It may reduce the chance that maintainer set wrong numbers to cause segmentation fault. My question is do I still need to add a logic to prevent error occurred for these kind of functions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can place FIXME or TODO comments for the above considerations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to place TODO comments. And could you share your experiences about the question? Cause in my experience, I only make sure that the internal function works without much error checks. I want to know how do experienced programmers think. Thanks 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking of the feasibility to re-use fill_rand_string to perform fuzzing: https://en.wikipedia.org/wiki/Fuzzing
Typically speaking, fuzzer might expect shorter strings to validate interpreter and/or qtest internals.

@YuShuanHsieh YuShuanHsieh force-pushed the feature/random-string branch from aee0b75 to 6635959 Compare January 29, 2020 08:56
@jserv jserv merged commit 38320ca into sysprog21:master Jan 29, 2020
@YuShuanHsieh YuShuanHsieh deleted the feature/random-string branch February 2, 2020 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants