This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository eshell.

View the commit online.

commit 2f8dac0dec3845afcfc4f0ce7c3e3355f689c823
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Thu Nov 21 13:20:21 2024 -0500

    lexer: Fix int overflow in eol()
    
    Shoutouts to rasterman for pointing out good syntax practices by wrapping it in (...) but instead actually pointing out an unsigned integer overflow (on accident?)
---
 escript/src/lexer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/escript/src/lexer.c b/escript/src/lexer.c
index a18fb6f..9282f8c 100644
--- a/escript/src/lexer.c
+++ b/escript/src/lexer.c
@@ -20,7 +20,7 @@ escript_lexer_init(struct Escript_Lexer* lex)
 
 // TODO going backwards code (not really encouraged)
 static char const*
-step_char(struct Escript_Lexer* lex, int step)
+step_char(struct Escript_Lexer* const lex, int step)
 {
 	for (int i = 0; i <= step; ++i)
 	{
@@ -32,9 +32,9 @@ step_char(struct Escript_Lexer* lex, int step)
 	}
 }
 
-static inline int eol(struct Escript_Lexer* lex, int step)
+static inline int eol(struct Escript_Lexer* const lex, int step)
 {
-	return lex->current_len - step <= 0;
+	return (lex->current_len < step) ? 0 : ((lex->current_len - step) <= 0);
 }
 
 static int

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to