[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v19 13/33] asn1_test: return either 0 or 1 to reflect the results
From: |
Gary Lin |
Subject: |
[PATCH v19 13/33] asn1_test: return either 0 or 1 to reflect the results |
Date: |
Fri, 6 Sep 2024 17:11:05 +0800 |
Some testcases use exit() to end the test. Since all the asn1 testcases
are invoked as functions, this commit replaces exit() with return to
reflect the test results, so that the main test function can check the
results.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Gary Lin <glin@suse.com>
---
...-either-0-or-1-to-reflect-the-result.patch | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644
grub-core/lib/libtasn1-patches/0011-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
diff --git
a/grub-core/lib/libtasn1-patches/0011-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
b/grub-core/lib/libtasn1-patches/0011-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
new file mode 100644
index 000000000..1d6f6a9e6
--- /dev/null
+++
b/grub-core/lib/libtasn1-patches/0011-asn1_test-return-either-0-or-1-to-reflect-the-result.patch
@@ -0,0 +1,72 @@
+From 39d0c31ea75b8cee4ea5769a7b5c3bb27b21ca83 Mon Sep 17 00:00:00 2001
+From: Gary Lin <glin@suse.com>
+Date: Fri, 16 Aug 2024 15:32:39 +0800
+Subject: [PATCH 11/12] asn1_test: return either 0 or 1 to reflect the results
+
+Some testcases use exit() to end the test. Since all the asn1 testcases
+are invoked as functions, this commit replaces exit() with return to
+reflect the test results, so that the main test function can check the
+results.
+
+Signed-off-by: Daniel Axtens <dja@axtens.net>
+Signed-off-by: Gary Lin <glin@suse.com>
+---
+ grub-core/tests/asn1/tests/CVE-2018-1000654.c | 6 +++---
+ grub-core/tests/asn1/tests/reproducers.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/grub-core/tests/asn1/tests/CVE-2018-1000654.c
b/grub-core/tests/asn1/tests/CVE-2018-1000654.c
+index 9eb4d7979..b78667900 100644
+--- a/grub-core/tests/asn1/tests/CVE-2018-1000654.c
++++ b/grub-core/tests/asn1/tests/CVE-2018-1000654.c
+@@ -40,7 +40,7 @@ test_CVE_2018_1000654 (void)
+ {
+ grub_printf ("Error: %s\nErrorDescription = %s\n\n",
+ asn1_strerror (result), errorDescription);
+- exit (1);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+@@ -52,10 +52,10 @@ test_CVE_2018_1000654 (void)
+ {
+ grub_printf ("Error: %s\nErrorDescription = %s\n\n",
+ asn1_strerror (result), errorDescription);
+- exit (1);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+
+- exit (0);
++ return 0;
+ }
+diff --git a/grub-core/tests/asn1/tests/reproducers.c
b/grub-core/tests/asn1/tests/reproducers.c
+index 278cfed6c..0e3c9fd65 100644
+--- a/grub-core/tests/asn1/tests/reproducers.c
++++ b/grub-core/tests/asn1/tests/reproducers.c
+@@ -59,7 +59,7 @@ test_reproducers (void)
+ if (result != ASN1_SUCCESS)
+ {
+ grub_printf ("Error: %s\nErrorDescription = %s\n\n", asn1_strerror
(result), errorDescription);
+- exit (EXIT_FAILURE);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+@@ -69,10 +69,10 @@ test_reproducers (void)
+ if (result != ASN1_SUCCESS)
+ {
+ grub_printf ("Error: %s\nErrorDescription = %s\n\n", asn1_strerror
(result), errorDescription);
+- exit (EXIT_FAILURE);
++ return 1;
+ }
+
+ asn1_delete_structure (&definitions);
+
+- exit (EXIT_SUCCESS);
++ return 0;
+ }
+--
+2.35.3
+
--
2.35.3
- [PATCH v19 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_cat(), (continued)
- [PATCH v19 04/33] libtasn1: replace strcat() with strcpy() in _asn1_str_cat(), Gary Lin, 2024/09/06
- [PATCH v19 05/33] libtasn1: replace strcat() with _asn1_str_cat(), Gary Lin, 2024/09/06
- [PATCH v19 02/33] libtasn1: import libtasn1-4.19.0, Gary Lin, 2024/09/06
- [PATCH v19 07/33] libtasn1: Use grub_divmod64() for division, Gary Lin, 2024/09/06
- [PATCH v19 06/33] libtasn1: adjust the header paths in libtasn1.h, Gary Lin, 2024/09/06
- [PATCH v19 08/33] libtasn1: fix the potential buffer overrun, Gary Lin, 2024/09/06
- [PATCH v19 09/33] asn1_test: include asn1_test.h only, Gary Lin, 2024/09/06
- [PATCH v19 10/33] asn1_test: rename the main functions to the test names, Gary Lin, 2024/09/06
- [PATCH v19 11/33] asn1_test: remove 'verbose' and the unnecessary printf(), Gary Lin, 2024/09/06
- [PATCH v19 12/33] asn1_test: print the error messages with grub_printf(), Gary Lin, 2024/09/06
- [PATCH v19 13/33] asn1_test: return either 0 or 1 to reflect the results,
Gary Lin <=
- [PATCH v19 14/33] asn1_test: use the grub-specific functions and types, Gary Lin, 2024/09/06
- [PATCH v19 15/33] libtasn1: compile into asn1 module, Gary Lin, 2024/09/06
- [PATCH v19 16/33] asn1_test: test module for libtasn1, Gary Lin, 2024/09/06
- [PATCH v19 17/33] libtasn1: Add the documentation, Gary Lin, 2024/09/06
- [PATCH v19 18/33] key_protector: Add key protectors framework, Gary Lin, 2024/09/06
- [PATCH v19 19/33] tss2: Add TPM2 buffer handling functions, Gary Lin, 2024/09/06
- [PATCH v19 20/33] tss2: Add TPM2 types and Marshal/Unmarshal functions, Gary Lin, 2024/09/06
- [PATCH v19 22/33] key_protector: Add TPM2 Key Protector, Gary Lin, 2024/09/06