Bug 17032
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 |
eu4bbt12phas4ek
There is no rand_s on Windows 2000.
Safari crashes with first html request.
Related files:
http://trac.webkit.org/projects/webkit/browser/trunk/JavaScriptCore/kjs/config.h
http://trac.webkit.org/projects/webkit/browser/trunk/JavaScriptCore/wtf/MathExtras.h
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
eu4bbt12phas4ek
see also:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101607
Mark Rowe (bdash)
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.
Adam Roben (:aroben)
(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.
eu4bbt12phas4ek
(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.
eu4bbt12phas4ek
correction:
if (do_check) {
do_check = false;
rand_s_exists = checkFor_rand_s();
}
Simon Hausmann
A more complete patch can also be found at
http://lists.trolltech.com/qt4-preview-feedback/2008-04/thread00028-0.html
Alexey Proskuryakov
(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.
Nils Jeisecke
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.
Gavin Barraclough
We don't appear to call rand_s any more.