New issue
Advanced search Search tips

Issue 751353 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Task



Sign in to add a comment

Editing code should use either int or size_t as integer types

Project Member Reported by xiaoche...@chromium.org, Aug 2 2017

Issue description

1. Use size_t for size/offset/..., and int or all other integer numbers.
2. When casting is needed, use checked_cast (instead of static_cast)
3. When necessary, use CheckedNumerics
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/021cdfa15f4336dcb632d64b4c672ad910aae6e3

commit 021cdfa15f4336dcb632d64b4c672ad910aae6e3
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Wed Aug 02 02:16:31 2017

Use unsigned integers in TextIterator

This patch changes TextIterator and its hellper classes to use unsigned
integers to get rid of unnecessary sign checks and type casts.

Public functions of TextIterator remain untouched.

Bug: 751353
Change-Id: I7b888d77fde272573c70f0a7fdbcc0410eec7e82
Reviewed-on: https://chromium-review.googlesource.com/595120
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491221}
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.h
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp
[modify] https://crrev.com/021cdfa15f4336dcb632d64b4c672ad910aae6e3/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h

Summary: Editing code should use either int or size_t as integer types (was: Editing code should use unsigned integers as much as possible)
According to the discussion, we should:

1. Use size_t for size/offset/..., and int or all other integer numbers.
2. When casting is needed, use checked_cast (instead of static_cast)
3. When necessary, use CheckedNumerics
Description: Show this description
Project Member

Comment 5 by sheriffbot@chromium.org, Aug 3

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment