crash in GetKerningPairs

Piotr Pawłow pp at
Wed Jan 11 10:55:00 CST 2006


Wine's implementation of GetKerningPairs in dlls/gdi/font.c behaves 
incorrectly (crashes) if lpkrnpair is NULL and nNumPairs is not zero.

Test program:


#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nCmdShow)
    HDC hdc = GetDC(NULL);
    int kp = GetKerningPairs(hdc, 1, NULL);
    char msg[200];
    sprintf(msg, "GetKerningPairs returns: %d\n", kp);
    MessageBox(NULL, msg, "success", MB_OK);
    return 0;


On Windows (tested on XP SP2) this program displays a message box and exits 
cleanly. On Wine it causes a page fault trying to write to address 

It's probably a trivial problem, but unfortunately I don't have time right now 
to investigate the issue and make a patch against current CVS.

Best regards,
 Piotr Pawłow
 mailto:pp at

More information about the wine-devel mailing list