Skip to content

Commit c9c5be0

Browse files
sstricklCommit Queue
authored andcommitted
[vm] Fix range checks in CheckOffsets.
Adjust the checks for runtime API ranges in CheckOffsets to account for ranges where the first index is not 0-valued when cast to an intptr_t. TEST=ci Change-Id: I5478f6bf44b41f0ce7d4689e0ae37cd825838a40 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444020 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Tess Strickland <[email protected]> Commit-Queue: Alexander Markov <[email protected]> Auto-Submit: Tess Strickland <[email protected]>
1 parent ff59623 commit c9c5be0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

runtime/vm/dart.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static void CheckOffsets() {
232232
i <= static_cast<intptr_t>(Last); i++) { \
233233
if (Filter(static_cast<Type>(i))) { \
234234
CHECK_OFFSET(Class::Getter(static_cast<Type>(i)), \
235-
AOT_##Class##_##Getter[i]); \
235+
AOT_##Class##_##Getter[i - static_cast<intptr_t>(First)]); \
236236
} \
237237
}
238238
#define CHECK_CONSTANT(Class, Name) \
@@ -257,7 +257,8 @@ static void CheckOffsets() {
257257
for (intptr_t i = static_cast<intptr_t>(First); \
258258
i <= static_cast<intptr_t>(Last); i++) { \
259259
if (Filter(static_cast<Type>(i))) { \
260-
CHECK_OFFSET(Class::Getter(static_cast<Type>(i)), Class##_##Getter[i]); \
260+
CHECK_OFFSET(Class::Getter(static_cast<Type>(i)), \
261+
Class##_##Getter[i - static_cast<intptr_t>(First)]); \
261262
} \
262263
}
263264
#define CHECK_CONSTANT(Class, Name) CHECK_OFFSET(Class::Name, Class##_##Name);

0 commit comments

Comments
 (0)