From 0d3158a3c122d48d65c4bd62c5ae8dc52b900422 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 19 Apr 2013 13:49:07 -0700 Subject: Make pthread_attr_getstack fail with EINVAL when called in "unspecified behavior" situation wherein the stackaddr was never set. --- nptl/ChangeLog | 5 +++++ nptl/pthread_attr_getstack.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index d2a1e477e4..85f0c40ffc 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2013-04-19 Roland McGrath + + * pthread_attr_getstack.c: Fail with EINVAL if the stack address has + not been set. + 2013-04-11 Andreas Schwab * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S diff --git a/nptl/pthread_attr_getstack.c b/nptl/pthread_attr_getstack.c index 03907b7242..696d8c07f6 100644 --- a/nptl/pthread_attr_getstack.c +++ b/nptl/pthread_attr_getstack.c @@ -31,6 +31,9 @@ __pthread_attr_getstack (attr, stackaddr, stacksize) assert (sizeof (*attr) >= sizeof (struct pthread_attr)); iattr = (struct pthread_attr *) attr; + if (!(iattr->flags & ATTR_FLAG_STACKADDR)) + return EINVAL; + /* Store the result. */ *stackaddr = (char *) iattr->stackaddr - iattr->stacksize; *stacksize = iattr->stacksize; -- cgit 1.4.1