Bug 1221694 - GCC 14: pesign package fails
Summary: GCC 14: pesign package fails
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Gary Ching-Pang Lin
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc14
  Show dependency treegraph
 
Reported: 2024-03-19 11:55 UTC by Michal Jireš
Modified: 2024-03-20 08:54 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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