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: change cannot-happen-test to a panic #13850

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

[PATCH] Coverity: change cannot-happen-test to a panic #13850

p5pRT opened this issue May 16, 2014 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented May 16, 2014

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

Searchable as RT121897$

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @jhi

Currently the ix cannot ever be less than zero (detected by Coverity).
Furthermore, it probably should never get less than zero, so panic if
that ever happens.

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @jhi

0001-Strengthen-the-ix-zero-min-clamping-to-panic.patch
From c1be4f5a83dc6dad6c65a673abd703ae417e2fa2 Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Tue, 6 May 2014 11:52:02 -0400
Subject: [PATCH] Strengthen the ix zero min-clamping to panic.

Currently the ix cannot ever be less than zero (detected by Coverity).
Furthermore, it probably should never get less than zero, so panic if
that ever happens.

Fix for Coverity perl5 CID 28946.
---
 pp_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pp_ctl.c b/pp_ctl.c
index 380a7fe..d63922d 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3088,7 +3088,7 @@ PP(pp_goto) /* also pp_dump */
 	    I32 oldsave;
 
 	    if (ix < 0)
-		ix = 0;
+		DIE(aTHX_ "panic: docatch: illegal ix=%ld", (long)ix);
 	    dounwind(ix);
 	    TOPBLOCK(cx);
 	    oldsave = PL_scopestack[PL_scopestack_ix];
-- 
1.8.5.2 (Apple Git-48)

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @tonycoz

On Fri May 16 08​:55​:12 2014, jhi wrote​:

Currently the ix cannot ever be less than zero (detected by Coverity).
Furthermore, it probably should never get less than zero, so panic if
that ever happens.

Applied as 5edb797 by Jarkko.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

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

@p5pRT p5pRT closed this as completed Jun 2, 2014
@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

@tonycoz - 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