0055-gnulib-regexec-Resolve-unused-variable.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From a983d36bd9178d377d2072fd4b11c635fdc404b4 Mon Sep 17 00:00:00 2001
  2. From: Darren Kenny <darren.kenny@oracle.com>
  3. Date: Wed, 21 Oct 2020 14:41:27 +0000
  4. Subject: [PATCH] gnulib/regexec: Resolve unused variable
  5. This is a really minor issue where a variable is being assigned to but
  6. not checked before it is overwritten again.
  7. The reason for this issue is that we are not building with DEBUG set and
  8. this in turn means that the assert() that reads the value of the
  9. variable match_last is being processed out.
  10. The solution, move the assignment to match_last in to an ifdef DEBUG too.
  11. Fixes: CID 292459
  12. Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
  13. Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
  14. [Add changes to generated files]
  15. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
  16. ---
  17. Makefile.in | 1 +
  18. conf/Makefile.extra-dist | 1 +
  19. grub-core/lib/gnulib-patches/fix-unused-value.patch | 14 ++++++++++++++
  20. grub-core/lib/gnulib/regexec.c | 4 ++++
  21. 4 files changed, 20 insertions(+)
  22. create mode 100644 grub-core/lib/gnulib-patches/fix-unused-value.patch
  23. diff --git a/Makefile.in b/Makefile.in
  24. index ecb3278..e6b287b 100644
  25. --- a/Makefile.in
  26. +++ b/Makefile.in
  27. @@ -2742,6 +2742,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
  28. grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
  29. grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
  30. grub-core/lib/gnulib-patches/fix-null-deref.patch \
  31. + grub-core/lib/gnulib-patches/fix-unused-value.patch \
  32. grub-core/lib/gnulib-patches/fix-width.patch \
  33. grub-core/lib/gnulib-patches/no-abort.patch \
  34. grub-core/lib/libgcrypt \
  35. diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
  36. index 46c4e95..9b01152 100644
  37. --- a/conf/Makefile.extra-dist
  38. +++ b/conf/Makefile.extra-dist
  39. @@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
  40. EXTRA_DIST += grub-core/genemuinitheader.sh
  41. EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
  42. +EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
  43. EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
  44. EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
  45. diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch
  46. new file mode 100644
  47. index 0000000..ba51f1b
  48. --- /dev/null
  49. +++ b/grub-core/lib/gnulib-patches/fix-unused-value.patch
  50. @@ -0,0 +1,14 @@
  51. +--- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000
  52. ++++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000
  53. +@@ -828,7 +828,11 @@
  54. + break;
  55. + if (__glibc_unlikely (err != REG_NOMATCH))
  56. + goto free_return;
  57. ++#ifdef DEBUG
  58. ++ /* Only used for assertion below when DEBUG is set, otherwise
  59. ++ it will be over-written when we loop around. */
  60. + match_last = -1;
  61. ++#endif
  62. + }
  63. + else
  64. + break; /* We found a match. */
  65. diff --git a/grub-core/lib/gnulib/regexec.c b/grub-core/lib/gnulib/regexec.c
  66. index 21cf791..98a25f5 100644
  67. --- a/grub-core/lib/gnulib/regexec.c
  68. +++ b/grub-core/lib/gnulib/regexec.c
  69. @@ -828,6 +828,10 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
  70. break;
  71. if (__glibc_unlikely (err != REG_NOMATCH))
  72. goto free_return;
  73. +#ifdef DEBUG
  74. + /* Only used for assertion below when DEBUG is set, otherwise
  75. + it will be over-written when we loop around. */
  76. +#endif
  77. match_last = -1;
  78. }
  79. else
  80. --
  81. 2.14.2