View Issue Details

IDProjectCategoryView StatusLast Update
0000527AlmaLinux-8libxsltpublic2025-07-01 14:22
Reportercloph Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Summary0000527: libxslt-devel-1.1.32-6.2.el8_10 breaks include guards / causes miscompilation due to misplaced #endif in header.
Descriptionhttps://git.almalinux.org/rpms/libxslt/src/branch/c8/SOURCES/libxslt-1.1.32-CVE-2023-40403.patch#L255 contains a bogus change to libxslt/xsltutils.h

It moves a #endif of the #ifdef __cplusplus up, having it act as the ending endif of the include-guard, and turning the to-be-meant endif of the include guard to the endif of the cplusplus block. While that prevents a compiler error, this obviously breaks the include guard and the build breaks if the header is included twice.
Steps To Reproduce$ cat foo.c
#include "libxslt/xsltutils.h"
#include "libxslt/xsltutils.h"

int main() {
    return 0;
}
$ gcc -I/usr/include/libxml2 foo.c
In file included from foo.c:2:
/usr/include/libxslt/xsltutils.h:292:5: error: redeclaration of enumerator ‘XSLT_DEBUG_NONE’
  292 | XSLT_DEBUG_NONE = 0, /* no debugging allowed */
      | ^~~~~~~~~~~~~~~
In file included from foo.c:1:
/usr/include/libxslt/xsltutils.h:292:5: note: previous definition of ‘XSLT_DEBUG_NONE’ with type ‘enum <anonymous>’
  292 | XSLT_DEBUG_NONE = 0, /* no debugging allowed */
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:293:5: error: redeclaration of enumerator ‘XSLT_DEBUG_INIT’
  293 | XSLT_DEBUG_INIT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:293:5: note: previous definition of ‘XSLT_DEBUG_INIT’ with type ‘enum <anonymous>’
  293 | XSLT_DEBUG_INIT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:294:5: error: redeclaration of enumerator ‘XSLT_DEBUG_STEP’
  294 | XSLT_DEBUG_STEP,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:294:5: note: previous definition of ‘XSLT_DEBUG_STEP’ with type ‘enum <anonymous>’
  294 | XSLT_DEBUG_STEP,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:295:5: error: redeclaration of enumerator ‘XSLT_DEBUG_STEPOUT’
  295 | XSLT_DEBUG_STEPOUT,
      | ^~~~~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:295:5: note: previous definition of ‘XSLT_DEBUG_STEPOUT’ with type ‘enum <anonymous>’
  295 | XSLT_DEBUG_STEPOUT,
      | ^~~~~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:296:5: error: redeclaration of enumerator ‘XSLT_DEBUG_NEXT’ [1/5500]
  296 | XSLT_DEBUG_NEXT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:296:5: note: previous definition of ‘XSLT_DEBUG_NEXT’ with type ‘enum <anonymous>’
  296 | XSLT_DEBUG_NEXT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:297:5: error: redeclaration of enumerator ‘XSLT_DEBUG_STOP’
  297 | XSLT_DEBUG_STOP,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:297:5: note: previous definition of ‘XSLT_DEBUG_STOP’ with type ‘enum <anonymous>’
  297 | XSLT_DEBUG_STOP,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:298:5: error: redeclaration of enumerator ‘XSLT_DEBUG_CONT’
  298 | XSLT_DEBUG_CONT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:298:5: note: previous definition of ‘XSLT_DEBUG_CONT’ with type ‘enum <anonymous>’
  298 | XSLT_DEBUG_CONT,
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:299:5: error: redeclaration of enumerator ‘XSLT_DEBUG_RUN’
  299 | XSLT_DEBUG_RUN,
      | ^~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:299:5: note: previous definition of ‘XSLT_DEBUG_RUN’ with type ‘enum <anonymous>’
  299 | XSLT_DEBUG_RUN,
      | ^~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:300:5: error: redeclaration of enumerator ‘XSLT_DEBUG_RUN_RESTART’
  300 | XSLT_DEBUG_RUN_RESTART,
      | ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:300:5: note: previous definition of ‘XSLT_DEBUG_RUN_RESTART’ with type ‘enum <anonymous>’
  300 | XSLT_DEBUG_RUN_RESTART,
      | ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:301:5: error: redeclaration of enumerator ‘XSLT_DEBUG_QUIT’
  301 | XSLT_DEBUG_QUIT
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:301:5: note: previous definition of ‘XSLT_DEBUG_QUIT’ with type ‘enum <anonymous>’
  301 | XSLT_DEBUG_QUIT
      | ^~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:302:3: error: conflicting types for ‘xsltDebugStatusCodes’; have ‘enum <anonymous>’
  302 | } xsltDebugStatusCodes;
      | ^~~~~~~~~~~~~~~~~~~~
/usr/include/libxslt/xsltutils.h:302:3: note: previous declaration of ‘xsltDebugStatusCodes’ with type ‘xsltDebugStatusCodes’
  302 | } xsltDebugStatusCodes;
      | ^~~~~~~~~~~~~~~~~~~~
$
Additional Informationrestoring the original placement of the #endif fixes the problem.
TagsNo tags attached.
abrt_hash
URL

Activities

metalefty

2025-07-01 14:14

manager   ~0001143

Confirmed. Ubuntu doesn't include such `#endif` movement.

c8
```
From e494220e4a57e87e8561e6798f57f4dcf91762b3 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 31 Aug 2022 15:29:57 +0200
Subject: [PATCH 1/5] Infrastructure to store extra data in source nodes

Provide a mechanism to store bit flags in nodes from the source
document. This will later be used to store key and id status.

Provide a function to find the psvi member of a node.

Revert any changes to the source document after the transformation.
---
 libxslt/transform.c | 34 ++++++++++
 libxslt/xsltInternals.h | 3 +
 libxslt/xsltutils.c | 135 ++++++++++++++++++++++++++++++++++++++++
 libxslt/xsltutils.h | 15 ++++-
 4 files changed, 186 insertions(+), 1 deletion(-)
```

Ubuntu 22.04 (https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/libxslt/1.1.34-4ubuntu0.22.04.4/libxslt_1.1.34-4ubuntu0.22.04.4.debian.tar.xz)
```
From adebe45f6ef9f9d036acacd8aec7411d4ea84e25 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 31 Aug 2022 15:29:57 +0200
Subject: [PATCH] Infrastructure to store extra data in source nodes

Provide a mechanism to store bit flags in nodes from the source
document. This will later be used to store key and id status.

Provide a function to find the psvi member of a node.

Revert any changes to the source document after the transformation.
---
 libxslt/transform.c | 34 ++++++++++
 libxslt/xsltInternals.h | 1 +
 libxslt/xsltutils.c | 135 ++++++++++++++++++++++++++++++++++++++++
 libxslt/xsltutils.h | 13 ++++
 4 files changed, 183 insertions(+)
```

metalefty

2025-07-01 14:19

manager   ~0001144

Last edited: 2025-07-01 14:22

https://gist.github.com/metalefty/61d7463e54e921533ce4a673fa17368e

Issue History

Date Modified Username Field Change
2025-06-26 10:32 cloph New Issue
2025-07-01 14:14 metalefty Note Added: 0001143
2025-07-01 14:19 metalefty Note Added: 0001144
2025-07-01 14:22 metalefty Note Edited: 0001144