Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] Coverity: UCHARAT unnecessary with isSPACE #13851

Closed
p5pRT opened this issue May 16, 2014 · 5 comments
Closed

[PATCH] Coverity: UCHARAT unnecessary with isSPACE #13851

p5pRT opened this issue May 16, 2014 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented May 16, 2014

Migrated from rt.perl.org#121898 (status was 'resolved')

Searchable as RT121898$

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @jhi

UCHARAT is not only unnecessary here (and no other spot in the core
seems to use UCHARAT with isFOO()), but it also narrows the type so
that some of the code in isSPACE() becomes unreachable.

Fix for Coverity perl5 CIDs 28937, 28938.

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @jhi

0001-UCHARAT-unnecessary-with-isSPACE.patch
From 3da7696b432c00fabb8b9bd56f86b6076e762d19 Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Tue, 6 May 2014 10:40:21 -0400
Subject: [PATCH] UCHARAT unnecessary with isSPACE().

UCHARAT is not only unnecessary here (and no other spot in the core
seems to use UCHARAT with isFOO()), but it also narrows the type so
that some of the code in isSPACE() becomes unreachable.

Fix for Coverity perl5 CIDs 28937, 28938.
---
 regcomp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index 920f7cb..884e1b0 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -13416,12 +13416,12 @@ parseit:
 		    e = strchr(RExC_parse++, '}');
                     if (!e)
                         vFAIL2("Missing right brace on \\%c{}", c);
-		    while (isSPACE(UCHARAT(RExC_parse)))
+		    while (isSPACE(*RExC_parse))
 		        RExC_parse++;
                     if (e == RExC_parse)
                         vFAIL2("Empty \\%c{}", c);
 		    n = e - RExC_parse;
-		    while (isSPACE(UCHARAT(RExC_parse + n - 1)))
+		    while (isSPACE(*(RExC_parse + n - 1)))
 		        n--;
 		}
 		else {
@@ -13441,7 +13441,7 @@ parseit:
                           * that bit) */
                          value ^= 'P' ^ 'p';
 
-			 while (isSPACE(UCHARAT(RExC_parse))) {
+			 while (isSPACE(*RExC_parse)) {
 			      RExC_parse++;
 			      n--;
 			 }
-- 
1.8.5.2 (Apple Git-48)

@p5pRT
Copy link
Author

p5pRT commented May 28, 2014

From @tsee

Thanks, applied as 40b5a54.

@p5pRT
Copy link
Author

p5pRT commented May 28, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 28, 2014

@tsee - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant