FOnline Development > General Discussion

[Source code] D3D Custom Font crash fix.

(1/1)

VVish:
Major error caused by unsafe code in the function that was creating texture for black border around symbols in the fonts was finally fixed. BufferOverflow is no more, at least in those particular functions.

This fix is for people who were crashing in D3D clients while using custom fonts (like HP font from PureEvil).

Native:

"SpriteManagerFont.cpp", functions "LoadFontFO" && "LoadFontBMF".

--- Code: ---for (uint y = 0; y < bh; y++)
        for (uint x = 0; x < bw; x++)
            if (SURF_POINT(lr, x, y))
                for (int xx = -1; xx <= 1; xx++)
                    for (int yy = -1; yy <= 1; yy++)
                        if (!SURF_POINT(lrb, x + xx, y + yy))
                            SURF_POINT(lrb, x + xx, y + yy) = 0xFF000000;

--- End code ---

->

Fix:

--- Code: ---for (uint y = 0; y < bh; y++)
    {
        for (uint x = 0; x < bw; x++)
        {
            if (SURF_POINT(lr, x, y))
            {
                for (int xx = -1; xx <= 1; xx++)
                {
                    if (x == 0 && xx == -1) continue;
                    if (x + xx >= bw) break;
                    for (int yy = -1; yy <= 1; yy++)
                    {
                        if (y == 0 && yy == -1) continue;
                        if (y + yy >= bh) break;
                        if (!SURF_POINT(lrb, x + xx, y + yy))
                        {
                            SURF_POINT(lrb, x + xx, y + yy) = 0xFF000000;
                        }
                    }
                }
            }
        }
    }
--- End code ---

Authors of the solution:
Sacred Cracker,
Vice Dice.

Technical advisors & debugging:
S1mancoder,
Wipe,
VVish.

Navigation

[0] Message Index

Go to full version