[webkit-reviews] review denied: [Bug 54190] Fix ignore return warning in OSRandomSource.cpp : [Attachment 81948] proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 10 04:21:58 PST 2011


Csaba Osztrogonac <ossy at webkit.org> has denied Peter Varga
<pvarga at webkit.org>'s request for review:
Bug 54190: Fix ignore return warning in OSRandomSource.cpp
https://bugs.webkit.org/show_bug.cgi?id=54190

Attachment 81948: proposed patch
https://bugs.webkit.org/attachment.cgi?id=81948&action=review

------- Additional Comments from Csaba Osztrogonac <ossy at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=81948&action=review

> Source/JavaScriptCore/wtf/OSRandomSource.cpp:54
>      if (fd < 0)
>	   CRASH(); // We need /dev/urandom for this API to work...
>  
> -    read(fd, buffer, length);
> -    close(fd);
> +    if (read(fd, buffer, length))
> +	   close(fd);

read returns 0 at the end of file and -1 on errors.
The return value should be length. If an error occures,
we should crash instead of using uninitialized buffer.

if (read(fd, buffer, length) == length)
  close(fd);
else
  CRASH();


More information about the webkit-reviews mailing list