News for hackers. Stuff that matters.
Re:Pastebin which is able to run your code. Accepts 40 langu... by onewland on Thursday November 19, 2009 @10:19AM (#950363)
I don't want to test on somebody's server and cause them to have a bad day, but does this thing have proper stack overflow/memory protection?

  #include <stdio.h>
  int evil(int y)
  {
      char *x = (char *) malloc(y);
      return(evil(y+1)-evil(y+2));
  }

  int main(int argc, char **argv)
  {
       int a = evil(1);
       return 0;
  }
Re:Pastebin which is able to run your code. Accepts 40 langu... by onewland on Thursday November 19, 2009 @11:43AM (#950527)
I'm getting an infinite (>5m wait time) "waiting for compilation" message with the above code.

Are you trying to traverse function calls before compilation? You'll eventually run into the halting problem (http://en.wikipedia.org/wiki/Halting_problem) if this is your approach, though there may be a way to determine cases as simple as mine.

Re:Pastebin which is able to run your code. Accepts 40 langu... by gacek on Thursday November 19, 2009 @12:00PM (#950564)
It won't compile ;) (no stdlib.h/string.h)

And it won't crash the server (at least... should not). There is a fixed limit on how much memory a process can allocate. This program will crash, but not because of malloc, just because the recursion gets too deep (stack overflow).

Re:Pastebin which is able to run your code. Accepts 40 langu... by onewland on Thursday November 19, 2009 @01:06PM (#950699)
Maybe it won't compile, but:

  /spoj/c_run: line 5:  3844 Segmentation fault      ./prog
is the error I got, and that doesn't look like a compile error. (Also, just to be pedantic, I had noted the stack overflow possibility in my original post).

http://ideone.com/view/09u9091w9h# is the snippet.