Esme Povirk (@madewokherd) commented about dlls/gdiplus/graphics.c:
to_measure_length = min(length - (i - index), section->end - i);get_font_hfont(graphics, section->font, NULL, &hfont, NULL, NULL);oldhfont = SelectObject(graphics->hdc, hfont);GetTextExtentExPointW(graphics->hdc, &string[i], to_measure_length, max_ext, &fitaux, NULL, &sizeaux);SelectObject(graphics->hdc, oldhfont);DeleteObject(hfont);max_ext -= sizeaux.cx;if (fit)*fit += fitaux;size->cx += sizeaux.cx;size->cy = max(size->cy, sizeaux.cy);i += to_measure_length;if ((i - index) >= length) break;
I think maybe the loop should also be broken in the case where `fitaux < to_measure_length`?