Jim Tcl
Check-in [b878884ca8]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:expr: prevent stack overflow

Limit the depth of the expressions to a reasonable level to prevent stack overflow

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b878884ca809135a84375a6ebf56ea697b208f0e
User & Date: steveb@workware.net.au 2018-01-18 01:01:15
Context
2018-03-25
00:47
linenoise: Update to support multiline mode.

Updated to: https://github.com/msteveb/linenoise/commit/ad5172e99520e2fe2a35b4bbd7fbc74d9df36df1

Now supports multiline mode (by setting $history::multiline to 1) Improved windows support

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 4f1592c24e user: steveb@workware.net.au tags: trunk

2018-01-18
01:01
expr: prevent stack overflow

Limit the depth of the expressions to a reasonable level to prevent stack overflow

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: b878884ca8 user: steveb@workware.net.au tags: trunk

2018-01-01
03:42
linenoise: Add ^Z (SUSP) support

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: ad3fb99587 user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to jim.c.

8826
8827
8828
8829
8830
8831
8832
8833



8834
8835
8836
8837
8838
8839
8840
static int ExprTreeBuildTree(Jim_Interp *interp, struct ExprBuilder *builder, int precedence, int flags, int exp_numterms)
{
    int rc;
    struct JimExprNode *node;
    /* Calculate the stack length expected after pushing the number of expected terms */
    int exp_stacklen = builder->stack.len + exp_numterms;

    builder->level++;




    while (builder->token->type != JIM_TT_EOL) {
        ParseToken *t = builder->token++;
        int prevtt;

        if (t == builder->first_token) {
            prevtt = JIM_TT_NONE;







|
>
>
>







8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
static int ExprTreeBuildTree(Jim_Interp *interp, struct ExprBuilder *builder, int precedence, int flags, int exp_numterms)
{
    int rc;
    struct JimExprNode *node;
    /* Calculate the stack length expected after pushing the number of expected terms */
    int exp_stacklen = builder->stack.len + exp_numterms;

    if (builder->level++ > 200) {
        Jim_SetResultString(interp, "Expression too complex", -1);
        return JIM_ERR;
    }

    while (builder->token->type != JIM_TT_EOL) {
        ParseToken *t = builder->token++;
        int prevtt;

        if (t == builder->first_token) {
            prevtt = JIM_TT_NONE;