Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit dfd5800

Browse files
committed
Bug 842630 - Fix out of bounds in nsSVGTextFrame2::ResolvePositions. r=heycam
1 parent 4dd126b commit dfd5800

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

layout/svg/crashtests/842630-1.svg

Lines changed: 1 addition & 0 deletions
Loading

layout/svg/crashtests/crashtests.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ load 813420-1.svg
154154
load 841163-1.svg
155155
load 841812-1.svg
156156
load 842009-1.svg
157+
load 842630-1.svg
157158
load 842909-1.svg
158159
load 843072-1.svg
159160
load 847139-1.svg

layout/svg/nsSVGTextFrame2.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,17 +4079,17 @@ nsSVGTextFrame2::ResolvePositions(nsTArray<gfxPoint>& aDeltas)
40794079

40804080
// Fill in unspecified positions for all remaining characters, noting
40814081
// them as unaddressable if they are.
4082-
uint32_t index = it.TextElementCharIndex();
4083-
for (uint32_t i = 0; i < index; i++) {
4084-
mPositions.AppendElement(CharPosition::Unspecified(false));
4085-
}
4082+
uint32_t index = 0;
40864083
while (it.Next()) {
40874084
while (++index < it.TextElementCharIndex()) {
40884085
mPositions.AppendElement(CharPosition::Unspecified(false));
40894086
}
40904087
mPositions.AppendElement(CharPosition::Unspecified(
40914088
it.IsOriginalCharUnaddressable()));
40924089
}
4090+
while (++index < it.TextElementCharIndex()) {
4091+
mPositions.AppendElement(CharPosition::Unspecified(false));
4092+
}
40934093

40944094
// Recurse over the content and fill in character positions as we go.
40954095
bool forceStartOfChunk = false;

0 commit comments

Comments
 (0)