[Webkit-unassigned] [Bug 146473] Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jun 30 16:00:41 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=146473
--- Comment #11 from Geoffrey Garen <ggaren at apple.com> ---
Comment on attachment 255869
--> https://bugs.webkit.org/attachment.cgi?id=255869
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=255869&action=review
> Source/WTF/wtf/OSRandomSource.cpp:67
> + if (currentRead < 0 && !(errno == EAGAIN || errno == EINTR))
I think it would be nicer to check for -1 explicitly, rather than implicitly by including all negatives in the test. The documentation states that read will return -1, 0, or a positive number, and it is nice to be precise.
You can simplify the logic here a bit and avoid testing currentRead twice like so:
if (currentRead == -1) {
if (!(errno == EAGAIN || errno == EINTR))
crashUnableToReadFromURandom();
} else
amountRead += currentRead;
This helps to clearly separate the failure case from the success case.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150630/69e70060/attachment-0001.html>
More information about the webkit-unassigned
mailing list