Skip to content

Conversation

@monojenkins
Copy link
Collaborator

Fixes #7564.

Backport of #7571.

/cc @rolfbjarne

@monojenkins monojenkins added this to the d16-4 milestone Dec 12, 2019
@rolfbjarne rolfbjarne added bug If an issue is a bug or a pull request a bug fix requires-approval-before-merge The pull request requires special approval before it can be merged labels Dec 12, 2019
Copy link
Contributor

@stephen-hawley stephen-hawley left a comment

Choose a reason for hiding this comment

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

Since I don't know the history of the file, it looks like this issue is the result of using a pattern of "check for full, then add" and failing to check.
Would it be better to make that pattern really obvious will something like:

if (FailOnBufferAtCapacity (struct_name, c, max_char, "useful error message"))
    return false;
...
static bool FailOnBufferAtCapacity(char *struct_name, int i, int max_char, char *message) {
    if (i == max_char) {
        LOGZ(message);
        struct_name[0] = 0;
        return true;
    }
    return false;
}

@monojenkins
Copy link
Collaborator Author

Build success
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
Test run succeeded

@chamons
Copy link
Contributor

chamons commented Dec 12, 2019

We'll let this go out with xcode 11.3 branch.

@chamons chamons closed this Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug If an issue is a bug or a pull request a bug fix requires-approval-before-merge The pull request requires special approval before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants