Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54654

Re: building an online judge to evaluate Python programs

References <CAOuJsM=vWQifowsgVK+upBGA3BdqWbETstqXi9127gcU9coOhg@mail.gmail.com> <l1i97a$qle$1@ger.gmane.org> <CAOuJsMm4kVL8_1LELgAB+sTxx+yVV8YQ4QV1aoHUp8y64+MEAQ@mail.gmail.com> <CAA=1kxT2WG=MQY+j1vvEBit8zjfQg=8P0ON9-usK=LfWXtohcw@mail.gmail.com> <52404006.1000801@nedbatchelder.com>
Date 2013-09-23 11:32 -0600
Subject Re: building an online judge to evaluate Python programs
From Modulok <modulok@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.274.1379957537.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

>
>
> If you want to run untrusted Python code and prevent malice (or stupidity)
> from harming you, you need OS-level protection.
>
>
Agreed. Just for fun here's a simple example of what could be an honest
mistake
that consumes all physical memory and swap. A well behaved kernel will kill
the
process eventually when it can no longer allocate memory, but not before
bringing the machine to its knees:

    class Foo(object):
        def __init__(self):
            self.x = 1
        def __iter__(self):
            return self
        def next(self):
            self.x += 1
            # Oops. In a well behaved iterator this should eventually
            # raise 'StopIteration'. I knew I forgot something.


    a = Foo()
    b = list(a)


-Modulok-

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: building an online judge to evaluate Python programs Modulok <modulok@gmail.com> - 2013-09-23 11:32 -0600

csiph-web