After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695932 - Segmentation fault when using | at end of pattern regex.
Segmentation fault when using | at end of pattern regex.
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: regexp
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-15 17:06 UTC by Robert Van Gorkom
Modified: 2021-07-05 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert Van Gorkom 2013-03-15 17:06:41 UTC
libxml2 issues a segmentation fault when creating xsd pattern regular expression that contains a specific pattern of () parenthesis and | pipes. You will notice I did this on OSX, however I experience the same issue on Ubuntu as well.

=text.xsd=
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
		
	<xs:element name="data">
		<xs:complexType>
			<xs:all>
				<xs:element name="phone1">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:pattern value="([0-9]{10})|"></xs:pattern>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:all>
		</xs:complexType>
	</xs:element>
</xs:schema>

=test.xml=
<?xml version="1.0" encoding="utf-8"?>
<data>
  <phone1>2484718566</phone1>
</data>

=GDB=
gdb --args xmllint --noout --schema test.xsd test.xml 
GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done

(gdb) run  
Starting program: /usr/bin/xmllint --noout --schema test.xsd test.xml
Reading symbols for shared libraries ++................................ done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000014
0x00007fff8f082e3e in xmlRegexpExec ()
(gdb) bt
  • #0 xmlRegexpExec
  • #1 xmlSchemaValidateFacets
  • #2 xmlSchemaVCheckCVCSimpleType
  • #3 xmlSchemaVCheckINodeDataType
  • #4 xmlSchemaValidatorPopElem
  • #5 xmlSchemaVStart
  • #6 _mh_execute_header
  • #7 _mh_execute_header
  • #8 start


=Regular expressions that work (Possible work arounds)=
([0-9]{10})|()
[0-9]{10}|
[0-9]{10}|()

=Regular expressions that do not work=
([0-9]{10})|

=How it should work=
Fail gracefully and let me know I have written a bad regular expression.
Comment 1 GNOME Infrastructure Team 2021-07-05 13:21:10 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.