[erlang-questions] managing OS processes

Ciprian Dorin Craciun ciprian.craciun@REDACTED
Tue May 29 18:17:26 CEST 2012


On Tue, May 29, 2012 at 7:13 PM, Jack Moffitt <jack@REDACTED> wrote:
>> over JSON than over a binary message. (BTW I use the `packet` Erlang
>> message framing `4 bytes length + payload`.)
>
> I have been using {packet, 2}. What happens when (via bad data or
> malicious intent) someone sends you 0xffffffff as the message size? Is
> there some way I haven't noticed to set a maximum allowed length on
> {packet, 4} packets?

    :) This problem hit me a few times before (someone wrote from the
process side to `stdout`).

    Interestingly enough (being on x86-32) it tried to allocate 2-4 GB
of data via `malloc`, returned `NULL`, the assertion was broken and
the controlled process was killed in a graceful manner.

    And as seen from the code I didn't fix it yet. :)

    But indeed such a check should have been made.

    Ciprian.



More information about the erlang-questions mailing list