Skip to Content.
Sympa Menu

svadev - [svadev] SAFECode and gmtime() / localtime()

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

[svadev] SAFECode and gmtime() / localtime()


Chronological Thread 
  • From: Matthew Wala <wala1 AT illinois.edu>
  • To: svadev AT cs.uiuc.edu
  • Subject: [svadev] SAFECode and gmtime() / localtime()
  • Date: Mon, 11 Jul 2011 11:06:02 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
  • List-id: <svadev.cs.uiuc.edu>

Hello everyone:
When I compile the attached test case with SAFECode (tried on asha and
bach) I get a large number of Out of Bounds / Load Store errors. The
test calls gmtime() which returns static memory. These errors also
occur if the function that is called is replaced with localtime().
However, other time-related functions that return static memory like
ctime() (as well as the reentrant versions of gmtime() and
localtime()) do not cause SAFECode to complain.
Before filing a bug I'd like to know if there is a reason for this
behavior or if this is already known.

Thanks,
Matt
#include <time.h>
#include <stdio.h>
#include <sys/time.h>

int main()
{
  struct tm *t;
  struct timeval tv;
  struct timezone tz;
  char *y;
  gettimeofday(&tv, &tz);
  t = gmtime(&tv.tv_sec);
  printf("%i %i %i %i %i %i %i %i %i\n",
         t->tm_sec,
         t->tm_min,
         t->tm_hour,
         t->tm_mday,
         t->tm_mon,
         t->tm_year,
         t->tm_wday,
         t->tm_yday,
         t->tm_isdst
         );
  return 0;
}



Archive powered by MHonArc 2.6.16.

Top of Page