# HG changeset patch # User Sergey Mironov # Date 1393407827 0 # Node ID cc7e5d469d1bad8d04ac38784877b2dc7d596727 # Parent c93fbd13973238c8127852dff34e3f1d75820bad Protect uw_Basis_new_client_source from invalid ctx->id We assume that FFI code may create new contextes with id left unassigned diff -r c93fbd139732 -r cc7e5d469d1b src/c/urweb.c --- a/src/c/urweb.c Wed Feb 26 08:21:52 2014 +0000 +++ b/src/c/urweb.c Wed Feb 26 09:43:47 2014 +0000 @@ -1586,6 +1586,9 @@ int len; size_t s_len = strlen(s); + if(ctx->id < 0) + uw_error(ctx, FATAL, "Attempt to create client source using inappropriate context"); + uw_check_script(ctx, 15 + 2 * INTS_MAX + s_len); sprintf(ctx->script.front, "s%d_%llu=sc(exec(%n", ctx->id, ctx->source_count, &len); ctx->script.front += len;