Skip to contentSkip to conversation

less: backport the fix for CVE-2022-46663

PATCH In review Ross Burton 3 participants 6 messages Feb 20, 2023 – Feb 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 less: backport the fix for CVE-2022-46663

---
 .../less/files/CVE-2022-46663.patch           | 28 +++++++++++++++++++
 meta/recipes-extended/less/less_608.bb        |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-extended/less/files/CVE-2022-46663.patch
meta/recipes-extended/less/files/CVE-2022-46663.patch new file +28 -0
new file mode 100644
index 00000000000..20f9d89ed86
@@ -0,0 +1,28 @@
+CVE: CVE-2022-46663
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From a78e1351113cef564d790a730d657a321624d79c Mon Sep 17 00:00:00 2001
+From: Mark Nudelman <[email protected]>
+Date: Fri, 7 Oct 2022 19:25:46 -0700
+Subject: [PATCH] End OSC8 hyperlink on invalid embedded escape sequence.
+
+---
+ line.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/line.c b/line.c
+index 236c49ae..cba7bdd1 100644
+--- a/line.c
++++ b/line.c
+@@ -633,8 +633,8 @@ ansi_step(pansi, ch)
+ 		/* Hyperlink ends with \7 or ESC-backslash. */
+ 		if (ch == '\7')
+ 			return ANSI_END;
+-		if (pansi->prev_esc && ch == '\\')
+-			return ANSI_END;
++		if (pansi->prev_esc)
++            return (ch == '\\') ? ANSI_END : ANSI_ERR;
+ 		pansi->prev_esc = (ch == ESC);
+ 		return ANSI_MID;
+ 	}
meta/recipes-extended/less/less_608.bb +1 -0
index f411a8fb53f..f907a8159cc 100644
@@ -26,6 +26,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
 DEPENDS = "ncurses"
 
 SRC_URI = "http://www.greenwoodsoftware.com/${BPN}/${BPN}-${PV}.tar.gz \
+           file://CVE-2022-46663.patch \
 	  "
 
 SRC_URI[sha256sum] = "a69abe2e0a126777e021d3b73aa3222e1b261f10e64624d41ec079685a6ac209"
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 tiff: backport fix for CVE-2022-48281

---
 .../libtiff/files/CVE-2022-48281.patch        | 29 +++++++++++++++++++
 meta/recipes-multimedia/libtiff/tiff_4.5.0.bb |  3 +-
 2 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-multimedia/libtiff/files/CVE-2022-48281.patch
meta/recipes-multimedia/libtiff/files/CVE-2022-48281.patch new file +29 -0
new file mode 100644
index 00000000000..e356d377ead
@@ -0,0 +1,29 @@
+CVE: CVE-2022-48281
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 97d65859bc29ee334012e9c73022d8a8e55ed586 Mon Sep 17 00:00:00 2001
+From: Su Laus <[email protected]>
+Date: Sat, 21 Jan 2023 15:58:10 +0000
+Subject: [PATCH] tiffcrop: Correct simple copy paste error. Fix #488.
+
+---
+ tools/tiffcrop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
+index 14fa18da..7db69883 100644
+--- a/tools/tiffcrop.c
++++ b/tools/tiffcrop.c
+@@ -8591,7 +8591,7 @@ static int processCropSelections(struct image_data *image,
+                     cropsize + NUM_BUFF_OVERSIZE_BYTES);
+             else
+             {
+-                prev_cropsize = seg_buffs[0].size;
++                prev_cropsize = seg_buffs[i].size;
+                 if (prev_cropsize < cropsize)
+                 {
+                     next_buff = _TIFFrealloc(
+-- 
+GitLab
+
meta/recipes-multimedia/libtiff/tiff_4.5.0.bb +2 -1
index e2cb512892b..f8a2482a848 100644
@@ -8,7 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a3e32d664d6db1386b4689c8121531c3"
 
 CVE_PRODUCT = "libtiff"
 
-SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz"
+SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
+           file://CVE-2022-48281.patch"
 
 SRC_URI[sha256sum] = "c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464"
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 glibc: backport the fix for CVE-2023-25139

In reply to Ross Burton
---
 ...r-grouping-in-printf-width-bug-30068.patch | 84 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.37.bb         |  1 +
 2 files changed, 85 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +84 -0
new file mode 100644
index 00000000000..9efd39a9eb4
@@ -0,0 +1,84 @@
+CVE: CVE-2023-25139
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 07b9521fc6369d000216b96562ff7c0ed32a16c4 Mon Sep 17 00:00:00 2001
+From: Carlos O'Donell <[email protected]>
+Date: Thu, 19 Jan 2023 12:50:20 +0100
+Subject: [PATCH] Account for grouping in printf width (bug 30068)
+
+This is a partial fix for mishandling of grouping when formatting
+integers.  It properly computes the width in the presence of grouping
+characters when the width is larger than the number of significant
+digits. The precision related issue is documented in bug 23432.
+
+Co-authored-by: Andreas Schwab <[email protected]>
+(cherry picked from commit c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0)
+---
+ stdio-common/Makefile               |  2 ++
+ stdio-common/tst-grouping3.c        | 54 +++++++++++++++++++++++++++++
+ stdio-common/vfprintf-process-arg.c | 22 +++++++++---
+ 3 files changed, 73 insertions(+), 5 deletions(-)
+ create mode 100644 stdio-common/tst-grouping3.c
+
+diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c
+index 24c9125f9f..8c0fcbcf78 100644
+--- a/stdio-common/vfprintf-process-arg.c
++++ b/stdio-common/vfprintf-process-arg.c
+@@ -186,11 +186,17 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+   bool octal_marker = (prec <= number_length && number.word != 0
+                        && alt && base == 8);
+ 
+-  prec = MAX (0, prec - (workend - string));
++  /* At this point prec_inc is the additional bytes required for the
++     specificed precision.  It is 0 if the precision would not have
++     required additional bytes i.e. the number of input digits is more
++     than the precision.  It is greater than zero if the precision is
++     more than the number of digits without grouping (precision only
++     considers digits).  */
++  unsigned int prec_inc = MAX (0, prec - (workend - string));
+ 
+   if (!left)
+     {
+-      width -= number_length + prec;
++      width -= number_length + prec_inc;
+ 
+       if (number.word != 0 && alt && (base == 16 || base == 2))
+         /* Account for 0X, 0x, 0B or 0b hex or binary marker.  */
+@@ -221,7 +227,7 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+           Xprintf_buffer_putc (buf, spec);
+         }
+ 
+-      width += prec;
++      width += prec_inc;
+       Xprintf_buffer_pad (buf, L_('0'), width);
+ 
+       if (octal_marker)
+@@ -237,6 +243,8 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+     }
+   else
+     {
++      /* Perform left justification adjustments.  */
++
+       if (is_negative)
+         {
+           Xprintf_buffer_putc (buf, L_('-'));
+@@ -263,9 +271,13 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+       if (octal_marker)
+ 	--width;
+ 
+-      width -= workend - string + prec;
++      /* Adjust the width by subtracting the number of bytes
++         required to represent the number with grouping characters
++	 (NUMBER_LENGTH) and any additional bytes required for
++	 precision.  */
++      width -= number_length + prec_inc;
+ 
+-      Xprintf_buffer_pad (buf, L_('0'), prec);
++      Xprintf_buffer_pad (buf, L_('0'), prec_inc);
+ 
+       if (octal_marker)
+         Xprintf_buffer_putc (buf, L_('0'));
+-- 
+2.34.1
+
meta/recipes-core/glibc/glibc_2.37.bb +1 -0
index f299a3004a4..e5689e536ad 100644
@@ -51,6 +51,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
            file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
            file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
+           file://0001-Account-for-grouping-in-printf-width-bug-30068.patch \
 "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
Signature · 1 line
2.34.1
#3 lore raw

Re: [OE-core] [PATCH 3/3] glibc: backport the fix for CVE-2023-25139

Ignore this, "glibc: stable 2.37 branch updates” incorporates it.

Ross

Quoted 123 lines · Ross Burton via lists.openembedded.org

---
...r-grouping-in-printf-width-bug-30068.patch | 84 +++++++++++++++++++
meta/recipes-core/glibc/glibc_2.37.bb | 1 +

2 files changed, 85 insertions(+)

create mode 100644 meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +84 -0
new file mode 100644
index 00000000000..9efd39a9eb4
@@ -0,0 +1,84 @@
+CVE: CVE-2023-25139
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 07b9521fc6369d000216b96562ff7c0ed32a16c4 Mon Sep 17 00:00:00 2001
+From: Carlos O'Donell <[email protected]>
+Date: Thu, 19 Jan 2023 12:50:20 +0100
+Subject: [PATCH] Account for grouping in printf width (bug 30068)
+
+This is a partial fix for mishandling of grouping when formatting
+integers.  It properly computes the width in the presence of grouping
+characters when the width is larger than the number of significant
+digits. The precision related issue is documented in bug 23432.
+
+Co-authored-by: Andreas Schwab <[email protected]>
+(cherry picked from commit c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0)
+---
+ stdio-common/Makefile               |  2 ++
+ stdio-common/tst-grouping3.c        | 54 +++++++++++++++++++++++++++++
+ stdio-common/vfprintf-process-arg.c | 22 +++++++++---
+ 3 files changed, 73 insertions(+), 5 deletions(-)
+ create mode 100644 stdio-common/tst-grouping3.c
+
+diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c
+index 24c9125f9f..8c0fcbcf78 100644
+--- a/stdio-common/vfprintf-process-arg.c
++++ b/stdio-common/vfprintf-process-arg.c
+@@ -186,11 +186,17 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+   bool octal_marker = (prec <= number_length && number.word != 0
+                        && alt && base == 8);
+ 
+-  prec = MAX (0, prec - (workend - string));
++  /* At this point prec_inc is the additional bytes required for the
++     specificed precision.  It is 0 if the precision would not have
++     required additional bytes i.e. the number of input digits is more
++     than the precision.  It is greater than zero if the precision is
++     more than the number of digits without grouping (precision only
++     considers digits).  */
++  unsigned int prec_inc = MAX (0, prec - (workend - string));
+ 
+   if (!left)
+     {
+-      width -= number_length + prec;
++      width -= number_length + prec_inc;
+ 
+       if (number.word != 0 && alt && (base == 16 || base == 2))
+         /* Account for 0X, 0x, 0B or 0b hex or binary marker.  */
+@@ -221,7 +227,7 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+           Xprintf_buffer_putc (buf, spec);
+         }
+ 
+-      width += prec;
++      width += prec_inc;
+       Xprintf_buffer_pad (buf, L_('0'), width);
+ 
+       if (octal_marker)
+@@ -237,6 +243,8 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+     }
+   else
+     {
++      /* Perform left justification adjustments.  */
++
+       if (is_negative)
+         {
+           Xprintf_buffer_putc (buf, L_('-'));
+@@ -263,9 +271,13 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
+       if (octal_marker)
+ --width;
+ 
+-      width -= workend - string + prec;
++      /* Adjust the width by subtracting the number of bytes
++         required to represent the number with grouping characters
++ (NUMBER_LENGTH) and any additional bytes required for
++ precision.  */
++      width -= number_length + prec_inc;
+ 
+-      Xprintf_buffer_pad (buf, L_('0'), prec);
++      Xprintf_buffer_pad (buf, L_('0'), prec_inc);
+ 
+       if (octal_marker)
+         Xprintf_buffer_putc (buf, L_('0'));
+-- 
+2.34.1
+
meta/recipes-core/glibc/glibc_2.37.bb +1 -0
index f299a3004a4..e5689e536ad 100644
@@ -51,6 +51,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
           file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
           file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
           file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
+           file://0001-Account-for-grouping-in-printf-width-bug-30068.patch \

"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build-${TARGET_SYS}"

Signature · 10 lines
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177440): https://lists.openembedded.org/g/openembedded-core/message/177440
Mute This Topic: https://lists.openembedded.org/mt/97089377/6875888
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#4 lore raw

Re: [OE-core] [PATCH 3/3] glibc: backport the fix for CVE-2023-25139

But then the cve should be marked as resolved?

Alex

Quoted 150 lines · Ross Burton

Ignore this, "glibc: stable 2.37 branch updates” incorporates it.

Ross

Quoted 1 line

On 20 Feb 2023, at 16:28, Ross Burton via lists.openembedded.org

Quoted 7 lines · <[email protected]> wrote:

---
...r-grouping-in-printf-width-bug-30068.patch | 84 +++++++++++++++++++
meta/recipes-core/glibc/glibc_2.37.bb | 1 +

2 files changed, 85 insertions(+)

create mode 100644

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 2 lines

diff --git

a/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch b/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 4 lines

new file mode 100644
index 00000000000..9efd39a9eb4
--- /dev/null
+++

b/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 15 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +14 -0
@@ -0,0 +1,84 @@
+CVE: CVE-2023-25139
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 07b9521fc6369d000216b96562ff7c0ed32a16c4 Mon Sep 17 00:00:00 2001
+From: Carlos O'Donell <[email protected]>
+Date: Thu, 19 Jan 2023 12:50:20 +0100
+Subject: [PATCH] Account for grouping in printf width (bug 30068)
+
+This is a partial fix for mishandling of grouping when formatting
+integers.  It properly computes the width in the presence of grouping
+characters when the width is larger than the number of significant
+digits. The precision related issue is documented in bug 23432.
+

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch line 24

Quoted 10 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +10 -0
+Co-authored-by: Andreas Schwab <[email protected]>
+(cherry picked from commit c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0)
+---
+ stdio-common/Makefile               |  2 ++
+ stdio-common/tst-grouping3.c        | 54 +++++++++++++++++++++++++++++
+ stdio-common/vfprintf-process-arg.c | 22 +++++++++---
+ 3 files changed, 73 insertions(+), 5 deletions(-)
+ create mode 100644 stdio-common/tst-grouping3.c
+
+diff --git a/stdio-common/vfprintf-process-arg.c

b/stdio-common/vfprintf-process-arg.c

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 4 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +4 -0
+index 24c9125f9f..8c0fcbcf78 100644
+--- a/stdio-common/vfprintf-process-arg.c
++++ b/stdio-common/vfprintf-process-arg.c
+@@ -186,11 +186,17 @@ LABEL (unsigned_number):      /* Unsigned number

of base BASE. */

Quoted 10 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +10 -0
+   bool octal_marker = (prec <= number_length && number.word != 0
+                        && alt && base == 8);
+
+-  prec = MAX (0, prec - (workend - string));
++  /* At this point prec_inc is the additional bytes required for the
++     specificed precision.  It is 0 if the precision would not have
++     required additional bytes i.e. the number of input digits is more
++     than the precision.  It is greater than zero if the precision is
++     more than the number of digits without grouping (precision only
++     considers digits).  */

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 10 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +10 -0
++  unsigned int prec_inc = MAX (0, prec - (workend - string));
+
+   if (!left)
+     {
+-      width -= number_length + prec;
++      width -= number_length + prec_inc;
+
+       if (number.word != 0 && alt && (base == 16 || base == 2))
+         /* Account for 0X, 0x, 0B or 0b hex or binary marker.  */
+@@ -221,7 +227,7 @@ LABEL (unsigned_number):      /* Unsigned number of

base BASE. */

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 9 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +9 -0
+           Xprintf_buffer_putc (buf, spec);
+         }
+
+-      width += prec;
++      width += prec_inc;
+       Xprintf_buffer_pad (buf, L_('0'), width);
+
+       if (octal_marker)
+@@ -237,6 +243,8 @@ LABEL (unsigned_number):      /* Unsigned number of

base BASE. */

meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch

Quoted 9 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +9 -0
+     }
+   else
+     {
++      /* Perform left justification adjustments.  */
++
+       if (is_negative)
+         {
+           Xprintf_buffer_putc (buf, L_('-'));
+@@ -263,9 +271,13 @@ LABEL (unsigned_number):      /* Unsigned number

of base BASE. */

Review

Quoted 19 lines
meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch new file +18 -0
+       if (octal_marker)
+ --width;
+
+-      width -= workend - string + prec;
++      /* Adjust the width by subtracting the number of bytes
++         required to represent the number with grouping characters
++ (NUMBER_LENGTH) and any additional bytes required for
++ precision.  */
++      width -= number_length + prec_inc;
+
+-      Xprintf_buffer_pad (buf, L_('0'), prec);
++      Xprintf_buffer_pad (buf, L_('0'), prec_inc);
+
+       if (octal_marker)
+         Xprintf_buffer_putc (buf, L_('0'));
+--
+2.34.1
+
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc_2.37.bb

meta/recipes-core/glibc/glibc_2.37.bb SRC_URI =

Quoted 4 lines

index f299a3004a4..e5689e536ad 100644

meta/recipes-core/glibc/glibc_2.37.bb +0 -0
@@ -51,6 +51,7 @@ SRC_URI =

"${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \

Quoted 1 line

file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \

Quoted 1 line

file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \

Quoted 1 line

file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \

Quoted 1 line

+

file://0001-Account-for-grouping-in-printf-width-bug-30068.patch \

Quoted 9 lines

"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build-${TARGET_SYS}"
--
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#177441):
https://lists.openembedded.org/g/openembedded-core/message/177441
Mute This Topic: https://lists.openembedded.org/mt/97089377/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Re: [OE-core] [PATCH 3/3] glibc: backport the fix for CVE-2023-25139

Quoted 1 line · Alexander Kanavin via lists.openembedded.org

But then the cve should be marked as resolved?

Yash is new to this game.

Yash,

Please submit an update along the lines of:
https://git.openembedded.org/openembedded-core/commit/?id=ebb0220bf211ec1318a0a7f6a9ab80cf7775a848

and next time you bump glibc/gcc/... indicate that the CVE is fixed by setting CVE_CHECK_IGNORE.

../Randy

Quoted 169 lines

Alex

On Mon 20. Feb 2023 at 17.34, Ross Burton <[email protected]> wrote:

    Ignore this, "glibc: stable 2.37 branch updates” incorporates it.

    Ross

    > On 20 Feb 2023, at 16:28, Ross Burton via lists.openembedded.org
    <http://lists.openembedded.org>
    <[email protected]> wrote:
    >
    > Signed-off-by: Ross Burton <[email protected]>
    > ---
    > ...r-grouping-in-printf-width-bug-30068.patch | 84
    +++++++++++++++++++
    > meta/recipes-core/glibc/glibc_2.37.bb <http://glibc_2.37.bb>    
       |  1 +
    > 2 files changed, 85 insertions(+)
    > create mode 100644
    meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch
    >
    > diff --git
    a/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch
    b/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch
    > new file mode 100644
    > index 00000000000..9efd39a9eb4
    > --- /dev/null
    > +++
    b/meta/recipes-core/glibc/glibc/0001-Account-for-grouping-in-printf-width-bug-30068.patch
    > @@ -0,0 +1,84 @@
    > +CVE: CVE-2023-25139
    > +Upstream-Status: Backport
    > +Signed-off-by: Ross Burton <[email protected]>
    > +
    > +From 07b9521fc6369d000216b96562ff7c0ed32a16c4 Mon Sep 17
    00:00:00 2001
    > +From: Carlos O'Donell <[email protected]>
    > +Date: Thu, 19 Jan 2023 12:50:20 +0100
    > +Subject: [PATCH] Account for grouping in printf width (bug 30068)
    > +
    > +This is a partial fix for mishandling of grouping when formatting
    > +integers.  It properly computes the width in the presence of
    grouping
    > +characters when the width is larger than the number of significant
    > +digits. The precision related issue is documented in bug 23432.
    > +
    > +Co-authored-by: Andreas Schwab <[email protected]>
    > +(cherry picked from commit
    c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0)
    > +---
    > + stdio-common/Makefile               |  2 ++
    > + stdio-common/tst-grouping3.c        | 54
    +++++++++++++++++++++++++++++
    > + stdio-common/vfprintf-process-arg.c | 22 +++++++++---
    > + 3 files changed, 73 insertions(+), 5 deletions(-)
    > + create mode 100644 stdio-common/tst-grouping3.c
    > +
    > +diff --git a/stdio-common/vfprintf-process-arg.c
    b/stdio-common/vfprintf-process-arg.c
    > +index 24c9125f9f..8c0fcbcf78 100644
    > +--- a/stdio-common/vfprintf-process-arg.c
    > ++++ b/stdio-common/vfprintf-process-arg.c
    > +@@ -186,11 +186,17 @@ LABEL (unsigned_number):      /* Unsigned
    number of base BASE.  */
    > +   bool octal_marker = (prec <= number_length && number.word != 0
    > +                        && alt && base == 8);
    > +
    > +-  prec = MAX (0, prec - (workend - string));
    > ++  /* At this point prec_inc is the additional bytes required
    for the
    > ++     specificed precision.  It is 0 if the precision would not
    have
    > ++     required additional bytes i.e. the number of input digits
    is more
    > ++     than the precision.  It is greater than zero if the
    precision is
    > ++     more than the number of digits without grouping
    (precision only
    > ++     considers digits).  */
    > ++  unsigned int prec_inc = MAX (0, prec - (workend - string));
    > +
    > +   if (!left)
    > +     {
    > +-      width -= number_length + prec;
    > ++      width -= number_length + prec_inc;
    > +
    > +       if (number.word != 0 && alt && (base == 16 || base == 2))
    > +         /* Account for 0X, 0x, 0B or 0b hex or binary marker.  */
    > +@@ -221,7 +227,7 @@ LABEL (unsigned_number):      /* Unsigned
    number of base BASE.  */
    > +           Xprintf_buffer_putc (buf, spec);
    > +         }
    > +
    > +-      width += prec;
    > ++      width += prec_inc;
    > +       Xprintf_buffer_pad (buf, L_('0'), width);
    > +
    > +       if (octal_marker)
    > +@@ -237,6 +243,8 @@ LABEL (unsigned_number):      /* Unsigned
    number of base BASE.  */
    > +     }
    > +   else
    > +     {
    > ++      /* Perform left justification adjustments.  */
    > ++
    > +       if (is_negative)
    > +         {
    > +           Xprintf_buffer_putc (buf, L_('-'));
    > +@@ -263,9 +271,13 @@ LABEL (unsigned_number):      /* Unsigned
    number of base BASE.  */
    > +       if (octal_marker)
    > + --width;
    > +
    > +-      width -= workend - string + prec;
    > ++      /* Adjust the width by subtracting the number of bytes
    > ++         required to represent the number with grouping characters
    > ++ (NUMBER_LENGTH) and any additional bytes required for
    > ++ precision.  */
    > ++      width -= number_length + prec_inc;
    > +
    > +-      Xprintf_buffer_pad (buf, L_('0'), prec);
    > ++      Xprintf_buffer_pad (buf, L_('0'), prec_inc);
    > +
    > +       if (octal_marker)
    > +         Xprintf_buffer_putc (buf, L_('0'));
    > +--
    > +2.34.1
    > +
    > diff --git a/meta/recipes-core/glibc/glibc_2.37.bb
    <http://glibc_2.37.bb> b/meta/recipes-core/glibc/glibc_2.37.bb
    <http://glibc_2.37.bb>
    > index f299a3004a4..e5689e536ad 100644
    > --- a/meta/recipes-core/glibc/glibc_2.37.bb <http://glibc_2.37.bb>
    > +++ b/meta/recipes-core/glibc/glibc_2.37.bb <http://glibc_2.37.bb>
    > @@ -51,6 +51,7 @@ SRC_URI =
    "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
    >
    file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \
    >
    file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
    \
    >
    file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch
    \
    > + file://0001-Account-for-grouping-in-printf-width-bug-30068.patch \
    > "
    > S = "${WORKDIR}/git"
    > B = "${WORKDIR}/build-${TARGET_SYS}"
    > --
    > 2.34.1
    >
    >
    >
    >

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177443):https://lists.openembedded.org/g/openembedded-core/message/177443 Mute This Topic:https://lists.openembedded.org/mt/97089377/3616765
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
# Randy MacLeod
# Wind River Linux