Append arg data as JSON to edge properties: ,"args":[{"i":0,"e":"x","v":"val"},...] * Returns new position in buffer. */ Sanitize expression string for JSON (in-place). */
| 2125 | * Returns new position in buffer. */ |
| 2126 | /* Sanitize expression string for JSON (in-place). */ |
| 2127 | static void sanitize_expr(char *expr_buf, const char *expr) { |
| 2128 | if (expr) { |
| 2129 | snprintf(expr_buf, 128, "%.*s", 120, expr); |
| 2130 | /* The 120-byte cut can land inside a multibyte character; a torn |
| 2131 | * sequence persisted as invalid UTF-8 in edge properties (2026-09-16 |
| 2132 | * probe: rust, java, typescript stores). */ |
| 2133 | cbm_utf8_trim_partial(expr_buf); |
| 2134 | for (char *p = expr_buf; *p; p++) { |
| 2135 | if (*p == '"') { |
| 2136 | *p = '\''; |
| 2137 | } |
| 2138 | if (*p == '\n' || *p == '\r') { |
| 2139 | *p = ' '; |
| 2140 | } |
| 2141 | } |
| 2142 | } else { |
| 2143 | expr_buf[0] = '\0'; |
| 2144 | } |
| 2145 | } |
| 2146 | |
| 2147 | /* Format one call arg as JSON. Returns snprintf result. */ |
| 2148 | static int format_call_arg(char *buf, size_t bufsize, const CBMCallArg *a, const char *expr) { |
no test coverage detected