Skip to content

intl: fix limit calculation - #41026

Merged
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
mhdawson:coverity-7
Dec 10, 2021
Merged

intl: fix limit calculation#41026
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
mhdawson:coverity-7

Conversation

@mhdawson

@mhdawsonmhdawson commented Nov 29, 2021

Copy link
Copy Markdown
Member

Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.

Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.

Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.

Signed-off-by: Michael Dawson mdawson@devrus.com

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. i18n-api Issues and PRs related to the i18n implementation. needs-ci PRs that need a full CI run. labels Nov 29, 2021
@mhdawson

Copy link
Copy Markdown
MemberAuthor

This is where I see that utf-16 may take 1 or 2 chars - https://en.wikipedia.org/wiki/UTF-16
And this is where I see that UChar is the baseline character for UTF-16 - https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/umachine_8h.html#a6bb9fad572d65b305324ef288165e2ac

@jasnell from history I can see you touched this code last and even though the code related to this was simply copied, maybe you have the best context to know if what I'm thinking from my look today makes sense?

Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.
Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.
Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.
Signed-off-by: Michael Dawson <mdawson@devrus.com>
@mhdawson
mhdawsonforce-pushed the coverity-7 branch 3 times, most recently from 0f736b0 to 54f24fbCompareNovember 29, 2021 23:20
@aduh95aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 3, 2021
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 3, 2021
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 10, 2021
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 10, 2021
@nodejs-github-bot
nodejs-github-bot merged commit 98ec909 into nodejs:masterDec 10, 2021
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 98ec909

danielleadams pushed a commit that referenced this pull request Dec 14, 2021
Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.
Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.
Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.
Signed-off-by: Michael Dawson <mdawson@devrus.com>
PR-URL: #41026
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.
Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.
Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.
Signed-off-by: Michael Dawson <mdawson@devrus.com>
PR-URL: #41026
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.
Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.
Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.
Signed-off-by: Michael Dawson <mdawson@devrus.com>
PR-URL: #41026
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
Coverity reported that the use of sizeof along with pointer
arithmetic was likely an error as the pointer arithmetic
would already be accounting for the size of what the
pointer points to.
Looking at the code that looked right but removing the
extra sizeOf caused tests to fail.
Looking more closely it seems like we were not allocating
a big enough buffer but the extra sizeof was allowing
us to convert even though it might have been corrupting
memory.
Signed-off-by: Michael Dawson <mdawson@devrus.com>
PR-URL: #41026
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@danielleadamsdanielleadams mentioned this pull request Feb 1, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.i18n-apiIssues and PRs related to the i18n implementation.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mhdawson@nodejs-github-bot@aduh95