WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
17032
No rand_s on Windows 2000 -> crash
https://bugs.webkit.org/show_bug.cgi?id=17032
Summary
No rand_s on Windows 2000 -> crash
eu4bbt12phas4ek
Reported
2008-01-27 12:04:02 PST
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
Comment 1
2008-01-27 12:08:23 PST
see also:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101607
Mark Rowe (bdash)
Comment 2
2008-01-27 18:02:29 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.
Adam Roben (:aroben)
Comment 3
2008-01-28 08:50:04 PST
(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
Comment 4
2008-02-04 13:05:30 PST
(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
Comment 5
2008-02-04 13:08:37 PST
correction: if (do_check) { do_check = false; rand_s_exists = checkFor_rand_s(); }
Simon Hausmann
Comment 6
2008-04-07 03:47:36 PDT
A more complete patch can also be found at
http://lists.trolltech.com/qt4-preview-feedback/2008-04/thread00028-0.html
Alexey Proskuryakov
Comment 7
2008-07-15 15:10:22 PDT
(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
Comment 8
2010-09-06 06:15:25 PDT
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
Comment 9
2012-09-06 17:30:26 PDT
We don't appear to call rand_s any more.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug