~sircmpwn/rc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] parse: Fix double free on slicing commands

Details
Message ID
<20240121104831.48643-2-max@mxsr.de>
DKIM signature
pass
Download raw message
Patch: +3 -3
Fixes: https://todo.sr.ht/~sircmpwn/rc/34
Signed-off-by: Max Schillinger <max@mxsr.de>
---
 parse/value.ha | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/parse/value.ha b/parse/value.ha
index eaca0bc..0abf33d 100644
--- a/parse/value.ha
+++ b/parse/value.ha
@@ -162,8 +162,8 @@ fn parse_access_range(p: *parser, access: *ast::access) (void | error) = {
		// or a dash
		if (arg == "-") {
			// p.e. $var(- 4) or $var(- $end)
			access.index = alloc("1": ast::string: ast::value);
			access.end = alloc("0": ast::string: ast::value);
			access.index = alloc(strings::dup("1"): ast::string: ast::value);
			access.end = alloc(strings::dup("0"): ast::string: ast::value);
			had_dash = true;
		} else if (strings::contains(arg, '-')) {
			// p.e. $var(2-4) or $var(2-) or $var(-4)
@@ -213,7 +213,7 @@ fn parse_access_range(p: *parser, access: *ast::access) (void | error) = {

	if (peek(p, ltok::RPAREN)? is lex::token) {
		if (access.end == null) {
			access.end = alloc("0": ast::string: ast::value);
			access.end = alloc(strings::dup("0"): ast::string: ast::value);
		};
	} else {
		const (end, _) = parse_value(p, true)?;
-- 
2.43.0
Reply to thread Export thread (mbox)