Skip to content
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

ICU-22934 clean up error handling in PR#3230 #3231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FrankYFTang
Copy link
Contributor

Checklist

  • Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22934
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@aheninger
Copy link
Contributor

Please add a unit test that triggers the recursion depth failures. It's not immediately obvious that there won't be memory leaks or other problems when they occur.

In functions with a newly added UErrorCode in PR #3230, double check the error handling. RBBINode::cloneTree(), for instance,

  • at line 216, set a U_MEMORY_ALLOCATION_ERROR and return immediately if the new fails.
  • make sure that you return a nullptr right away, and don't leak, in the event of a failure returned from the recursive calls at lines 220 and 226

In RBBINode::flattenSets(), maybe make the setRefNode variables into localPointers, so you can more easily return immediately if the cloneTree() calls set an error.

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/common/rbbinode.cpp is different
  • icu4c/source/common/rbbiscan.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@FrankYFTang
Copy link
Contributor Author

Please add a unit test that triggers the recursion depth failures.

I have the problem to do that. The fuzzer found test case is > 400k in a file.

@FrankYFTang FrankYFTang changed the title ICU-22934 Fix typo in PR#3230 ICU-22934 clean up error handling in PR#3230 Oct 10, 2024
ICU-22934 Fix error handling while new return nullptr

ICU-22934 Simplfied

ICU-22934 more

ICU-22934 fix leak
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/common/rbbinode.cpp is different
  • icu4c/source/common/rbbiscan.cpp is different
  • icu4c/source/common/rbbisetb.cpp is different
  • icu4c/source/common/rbbitblb.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@aheninger
Copy link
Contributor

Please add a unit test that triggers the recursion depth failures.

I have the problem to do that. The fuzzer found test case is > 400k in a file.

Hi Frank,
I've started to look at creating test cases, but have run into some behavior that I don't fully understand. I'll continue with it and get you something workable. Unfortunately I will be busy for most of the coming week, so it won't happen right away.

@FrankYFTang
Copy link
Contributor Author

Please add a unit test that triggers the recursion depth failures.

I have the problem to do that. The fuzzer found test case is > 400k in a file.

Hi Frank, I've started to look at creating test cases, but have run into some behavior that I don't fully understand. I'll continue with it and get you something workable. Unfortunately I will be busy for most of the coming week, so it won't happen right away.

ping

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