<div dir="ltr"><div>Hi all,</div><div><br></div><div>During recent debugging looking at JDK-8148334 [1], I ran across `TextLine.createComponentsOnRun(...)`, which seems to be a bit too eager to expand the component array, leading to the following steps:</div><div><br></div><div>1. `TextLine.fastCreateTextLine(...)` allocates a one-element component array, passing it to `createComponentsOnRun(...)`</div><div>2. `createComponentsOnRun(...)` adds a single element to the array, but expands the array (i.e. creates a new larger array) to fit more (non-existent) elements, returning the larger array<br></div><div>3. `TextLine.fastCreateTextLine(...)` detects the larger-than-necessary array, and trims it back down to size (i.e. creates a new smaller array)</div><div><br></div><div>The fix is simple: check if `numComponents > components.length` before expanding the array, instead of the current check of `numComponents >= components.length`.</div><div><br></div><div>Could somebody file a bug in the issue tracker, so that I can submit a PR to fix this? I do not have access to create issues.</div><div><br></div><div>Thanks!</div><div><br></div><div>Daniel<br></div><div></div><div><br></div><div>[1] <a href="https://bugs.openjdk.org/browse/JDK-8148334">https://bugs.openjdk.org/browse/JDK-8148334</a></div><div><br></div><div><br></div></div>