Bug 1221694

Summary: GCC 14: pesign package fails
Product: [openSUSE] openSUSE Tumbleweed Reporter: Michal Jireš <michal.jires>
Component: BasesystemAssignee: Gary Ching-Pang Lin <glin>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: glin
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 1220574    

Description Michal Jireš 2024-03-19 11:55:28 UTC
Building pesign with GCC 14 fails here:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/pesign/standard/x86_64

Due to:

pesigcheck.c: In function ‘check_signature’:
pesigcheck.c:243:34: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  243 |         reasonps = calloc(sizeof(struct reason), 512);
      |                                  ^~~~~~
pesigcheck.c:243:34: note: earlier argument should specify number of elements, later size of each element
pesigcheck.c:284:53: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  284 |                         new_reasons = calloc(sizeof(struct reason), num_reasons);
      |                                                     ^~~~~~
pesigcheck.c:284:53: note: earlier argument should specify number of elements, later size of each element





Builds with automatically generated:

Index: pesign-116/src/pesigcheck.c
===================================================================
--- pesign-116.orig/src/pesigcheck.c
+++ pesign-116/src/pesigcheck.c
@@ -240,7 +240,7 @@ check_signature(pesigcheck_context *ctx,

 	cert_iter iter;

-	reasonps = calloc(sizeof(struct reason), 512);
+	reasonps = calloc(512, sizeof(struct reason));
 	if (!reasonps)
 		err(1, "check_signature");

@@ -281,7 +281,7 @@ check_signature(pesigcheck_context *ctx,

 			num_reasons += 16;

-			new_reasons = calloc(sizeof(struct reason), num_reasons);
+			new_reasons = calloc(num_reasons, sizeof(struct reason));
 			if (!new_reasons)
 				err(1, "check_signature");
 			reasonps = new_reasons;
Comment 1 Gary Ching-Pang Lin 2024-03-20 08:42:32 UTC
Upstream fix:
https://github.com/rhboot/pesign/commit/1f9e2fa0b4d872fdd01ca3ba81b04dfb1211a187
Comment 2 Gary Ching-Pang Lin 2024-03-20 08:54:54 UTC
Fixed with sr#1159787