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-20832 use uint32_t instead of uint16_t to avoid overflows for very long strings #840

Merged
merged 1 commit into from
Sep 25, 2019

Conversation

adamsitnik
Copy link
Contributor

@adamsitnik adamsitnik commented Sep 25, 2019

Checklist

@CLAassistant
Copy link

CLAassistant commented Sep 25, 2019

CLA assistant check
All committers have signed the CLA.

@jefgen jefgen self-assigned this Sep 25, 2019
@@ -317,7 +317,7 @@ inline uint16_t initializePatternCETable(UStringSearch *strsrch,
uprv_free(pattern->ces);
}

uint16_t offset = 0;
uint32_t offset = 0;
Copy link
Contributor

@pedberg-icu pedberg-icu Sep 25, 2019

Choose a reason for hiding this comment

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

Hmm. There is inconsistency in the places this offset value is used; some are int32_t (like pattern->cesLength, pattern->pcesLength) and some are uint32_t (like the corresponding parameter in addTouint64_tArray). We may need to be more consistent about usage. But I guess that could be later fix, the chanage proposed here does solve the immediate overflow problem

Copy link
Member

Choose a reason for hiding this comment

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

Thanks Peter. I could file a follow up ticket for 66 or 67, and this ticket could be just for the maint-65 release.

Copy link
Member

Choose a reason for hiding this comment

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

I filed a follow-up ticket: https://unicode-org.atlassian.net/browse/ICU-20833

Aside: Since addTouint64_tArray uses uint32_t I wonder if we'd want to use that everywhere in here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, probably uint32_t everywhere is best. Thanks for the followup! Will approve this one for 65.

@@ -388,7 +388,7 @@ inline uint16_t initializePatternPCETable(UStringSearch *strsrch,
uprv_free(pattern->pces);
}

uint16_t offset = 0;
uint32_t offset = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above about int32_t vs uint32_t.

@jefgen
Copy link
Member

jefgen commented Sep 25, 2019

Thank you for reporting the issue (filing a ticket/issue) and for creating the PR!

In the ICU-TC call this ticket/PR was discussed and the general consensus was that this would be okay for the maint/maint-65 branch, pending review on the changes from Peter. (Thank you Peter).

I'll change the target branch on this PR to be into the maint branch in moment.

@jefgen jefgen changed the base branch from master to maint/maint-65 September 25, 2019 18:30
Copy link
Member

@jefgen jefgen left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@jefgen jefgen merged commit 1f4a77c into unicode-org:maint/maint-65 Sep 25, 2019
@adamsitnik adamsitnik deleted the int16_overflow branch September 26, 2019 06:22
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.

4 participants