[Webkit-unassigned] [Bug 54190] Fix ignore return warning in OSRandomSource.cpp

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


https://bugs.webkit.org/show_bug.cgi?id=54190


Csaba Osztrogonac <ossy at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #81948|review?, commit-queue?      |review-, commit-queue-
               Flag|                            |




--- Comment #2 from Csaba Osztrogonac <ossy at webkit.org>  2011-02-10 04:21:59 PST ---
(From update of attachment 81948)
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();

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list