Summary: | No rand_s on Windows 2000 -> crash | ||
---|---|---|---|
Product: | WebKit | Reporter: | eu4bbt12phas4ek |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Minor | CC: | ap, barraclough, hausmann, jeisecke, xhva.net |
Priority: | P4 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | Windows 2000 |
Description
eu4bbt12phas4ek
2008-01-27 12:04:02 PST
http://www.apple.com/safari/download/ states that Safari is only supported on Windows XP and Vista. Windows XP has been the minimum officially supported version since the initial beta release. (In reply to comment #2) > http://www.apple.com/safari/download/ states that Safari is only supported on > Windows XP and Vista. Windows XP has been the minimum officially supported > version since the initial beta release. That's not to say this bug can't be fixed, though! We'll gladly accept a patch to fix this that doesn't regress other platforms. (In reply to comment #3) > That's not to say this bug can't be fixed, though! We'll gladly accept a patch > to fix this that doesn't regress other platforms. I've found the bug through Qt's webkit integration, and I assume they wanna support win2k. The solution is to not use rand_s on win2k. But to have only one binary excludes a macro solution. It must be checked for rand_s at runtime: somewhere in a cpp file: #include <windows.h> bool checkFor_rand_s() { HMODULE dll = LoadLibrary("ADVAPI32.DLL"); if (dll && GetProcAddress(dll, "RtlGenRandom") ) { FreeLibrary(dll); return true; } FreeLibrary(dll); return false; } And a dynamic switch in wtf_random_init/wtf_random, static bool do_check = true; static bool rand_s_exists = false; if (do_check) { rand_s_exists = checkFor_rand_s(); } if (rand_s_exists) { .... } The only problem I see is that it is ugly and that it eventually breaks the inlining of the rand functions. correction: if (do_check) { do_check = false; rand_s_exists = checkFor_rand_s(); } A more complete patch can also be found at http://lists.trolltech.com/qt4-preview-feedback/2008-04/thread00028-0.html (In reply to comment #6) > http://lists.trolltech.com/qt4-preview-feedback/2008-04/thread00028-0.html +void check_for_rand_s() +{ + if (!already_checked) { There is no need for this check - check_for_rand_s() is called from wtf_random_init(), which is guaranteed to be called once. Nobody interested in Windows 2000 any more? The code seems to have been moved to JavaScriptCore/wtf/RandomNumber.cpp but the idea of the patch should still solve the problem. We don't appear to call rand_s any more. |