public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3662] New: Implementation bugs in random_r and friends
@ 2006-12-05 19:59 glibcbugs0000 at cneufeld dot ca
  2006-12-05 23:58 ` [Bug libc/3662] " drepper at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: glibcbugs0000 at cneufeld dot ca @ 2006-12-05 19:59 UTC (permalink / raw)
  To: glibc-bugs

There are at least two implementation bugs in the random_r class of functions.

First, the random_data structure, being opaque, is typically just allocated on
the stack or malloc()ed.  There is no way to create a valid "this is not an old
state vector" structure without knowing the implementation details of the
structure.  If the compiler does not initialize the "state" member of the
structure to a value equal to the NULL pointer, the initstate_r() function will
crash as it dereferences whatever non-NULL but invalid value is held there.  We
need a method to create a blank random_data object, or the documentation has to
point out that the user is responsible for initializing the "state" member to NULL.

Second, initstate_r() and setstate_r() are documented in their comment blocks as
returning a pointer to the old state, but they do not.  There is no documented
way to retrieve the old state in a fashion that allows it to be re-introduced
into the system with setstate_r() at a later time.  As such, the setstate_r()
function is essentially unusable.

-- 
           Summary: Implementation bugs in random_r and friends
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: glibcbugs0000 at cneufeld dot ca
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-06 15:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-3662-131@http.sourceware.org/bugzilla/>
2012-12-19 10:51 ` [Bug libc/3662] Implementation bugs in random_r and friends schwab@linux-m68k.org
2015-10-06 15:36 ` archie.cobbs at gmail dot com
2006-12-05 19:59 [Bug libc/3662] New: " glibcbugs0000 at cneufeld dot ca
2006-12-05 23:58 ` [Bug libc/3662] " drepper at redhat dot com
2006-12-06  3:02 ` glibcbugs0000 at cneufeld dot ca
2009-11-25  3:25 ` kenta at cs dot stanford dot edu
2009-11-25  3:25 ` kenta at cs dot stanford dot edu
2009-11-25  4:36 ` drepper at redhat dot com
2009-11-25 12:20 ` glibcbugs0000 at cneufeld dot ca
2009-11-25 14:26 ` drepper at redhat dot com
2009-11-25 14:51 ` glibcbugs0000 at cneufeld dot ca
2009-11-25 15:21 ` glibcbugs0000 at cneufeld dot ca
2010-07-27  7:58 ` kenta at cs dot stanford dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).