8000 Tolerate unintialized list in aws_array_list_length by waahm7 · Pull Request #1019 · awslabs/aws-c-common · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tolerate unintialized list in aws_array_list_length #1019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Apr 26, 2023
Merged

Conversation

waahm7
Copy link
Contributor
@waahm7 waahm7 commented Apr 24, 2023

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link
codecov-commenter commented Apr 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.05%. Comparing base (b0fe4ee) to head (81d26dc).
Report is 143 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1019      +/-   ##
==========================================
+ Coverage   82.03%   82.05%   +0.02%     
==========================================
  Files          52       52              
  Lines        5649     5650       +1     
==========================================
+ Hits         4634     4636       +2     
+ Misses       1015     1014       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +117 to +118
int result = aws_array_list_get_at_ptr(options->query_params, (void **)&uri_param_ptr, i);
AWS_FATAL_ASSERT(result == AWS_OP_SUCCESS);
Copy link
Contributor Author
@waahm7 waahm7 Apr 24, 2023

Choose a reason for hiding this comment

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

Lint started complaining that uri_param_ptr can be NULL and we are dereferencing it. However, it cannot be NULL as index will always be valid.

Logs: https://github.com/awslabs/aws-c-common/actions/runs/4788915778/jobs/8516145068?pr=1019

@waahm7 waahm7 changed the title Tolerate unintialized list in aws_array_list_length WIP | Tolerate unintialized list in aws_array_list_length Apr 24, 2023
@waahm7 waahm7 marked this pull request as draft April 24, 2023 20:27
@waahm7 waahm7 changed the title WIP | Tolerate unintialized list in aws_array_list_length Tolerate unintialized list in aws_array_list_length Apr 25, 2023
@waahm7 waahm7 marked this pull request as ready for review April 25, 2023 20:52
Comment on lines 407 to 409
# if defined(AWS_WIN_ABORT_POP_UP_DISABLE)
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
# endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# if defined(AWS_WIN_ABORT_POP_UP_DISABLE)
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
# endif
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);

I vote that we simply always do this.

Get rid of the AWS_WIN_ABORT_POP_UP_DISABLE cmake option, and cmakedefine, and --cmake-extra, and comment explaining why we need it in every ci.yml...

If we always set it, you'll still break in a debugger, if you have a debugger attached, see the implementation of aws_fatal_assert(), which calls aws_debug_break() which breaks into debugger if a debugger is attached, before calling abort().

Copy link
Contributor

Choose a reason for hiding this comment

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

The only advantage of Windows' weird abort() popup is that it helps you break into a debugger. But no other platform does this, which is why we wrote our own logic to break into the debugger, which makes the popup totally useless for our tests...

always suppressing it will make tests on windows work like they do on all our other platforms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

Comment on lines +409 to +411
#ifdef _MSC_VER
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

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

During my local testing, I found out that MinGW fails to link with _set_abort_behavior and doesn't have the pop-up behavior.

@waahm7 waahm7 merged commit 5ba2fa2 into main Apr 26, 2023
@waahm7 waahm7 deleted the array-list-fix branch April 26, 2023 22:23
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.

3 participants
0