{"record":{"id":"d3fc26094314a292","repo":"Yalantis/uCrop","slug":"cimg-appname-math-parser-cimg-s-s-s-inval-d3fc26","errorCode":null,"errorMessage":"[cimg_appname_math_parser] CImg<%s>::%s: %s: Invalid %slvalue '%s', in expression '%s'.","messagePattern":"\\[cimg_appname_math_parser\\] CImg<(.+?)>::(.+?): (.+?): Invalid (.+?)lvalue '(.+?)', in expression '(.+?)'\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":18868,"sourceCode":"                  CImg<ulongT>::vector((ulongT)mp_vector_copy,arg1,arg2,(ulongT)size(arg1)).\n                    move_to(code);\n                else // From scalar\n                  CImg<ulongT>::vector((ulongT)mp_vector_init,arg1,1,(ulongT)size(arg1),arg2).\n                    move_to(code);\n                _cimg_mp_return(arg1);\n              }\n\n              if (is_reserved(arg1)) { // Scalar variable: s = scalar\n                _cimg_mp_check_type(arg2,2,1,0);\n                CImg<ulongT>::vector((ulongT)mp_copy,arg1,arg2).move_to(code);\n                _cimg_mp_return(arg1);\n              }\n            }\n\n            // No assignment expressions match -> error.\n            cimg::strellipsize(variable_name,64);\n            _cimg_mp_strerr;\n            throw CImgArgumentException(\"[\" cimg_appname \"_math_parser] \"\n                                        \"CImg<%s>::%s: %s: Invalid %slvalue '%s', \"\n                                        \"in expression '%s'.\",\n                                        pixel_type(),_cimg_mp_calling_function,s_op,\n                                        arg1!=~0U && is_const_scalar(arg1)?\"const \":\"\",\n                                        variable_name._data,s0);\n          }\n        }\n\n        // Apply unary/binary/ternary operators. The operator precedences should be the same as in C++.\n        is_sth = true;\n        for (s = ss; s<se1; ++s) // Do a first pass to quickly skip costly operator checks that require for() loop\n          if (cimg::_cimg_math_parser_check_operator[(unsigned char)*s] && level[s - expr._data]==clevel) {\n            is_sth = false; break;\n          }\n        if (is_sth) goto cimg_skip_iterative_operator_parsing;\n\n        for (s = se2, ps = se3, ns = ps - 1; s>ss1; --s, --ps, --ns) // Here, ns = ps - 1\n          if (*s=='=' && (*ps=='*' || *ps=='/' || *ps=='^') && *ns==*ps &&","sourceCodeStart":18850,"sourceCodeEnd":18886,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L18850-L18886","documentation":"The left-hand side of an assignment in a math-parser expression must be a valid assignable target (a variable or vector element). If no assignment form matches, the parser reports the target as an invalid lvalue; if the target is a const scalar it is flagged as such.","triggerScenarios":"Writing assignments to literals, function calls, or const scalars, e.g. '5 = x', 'sin(x) = 3', or 'const_var = 1'.","commonSituations":"Reversed assignment directions after refactoring, typos where the intended '=' became '==' or vice versa, attempts to mutate const values.","solutions":["Make the left side a plain variable name that is not const","Swap operands if the assignment direction is reversed","Store intermediate results in a mutable variable first"],"exampleFix":"// before\nsin(x) = 3;\n// after\ny = sin(x);","handlingStrategy":"validation","validationCode":"function isPlainLhs(expr) {\n  const m = expr.match(/([^=])=([^=]|$)/);\n  if (!m) return true;\n  return /^[A-Za-z_]\\w*\\s*=/.test(expr.trim());\n}\n","typeGuard":null,"tryCatchPattern":"try {\n  img.evaluate(expr);\n} catch (e) {\n  if (/Invalid .*lvalue/.test(String(e))) {\n    // rewrite LHS as a mutable variable\n  } else throw e;\n}\n","preventionTips":["Only assign to simple variable names or declared vector elements","Check '=' vs '==' when writing assignments","Do not assign to function calls or literals"],"tags":["cimg","math-parser","lvalue","assignment"],"backgroundTag":"invalid-argument-value","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}