Patch to forbid epsilon-reduction of final states

When building the internal representation of a regexp, it is possible
that a lot of empty transitions are created. Therefore there is a step
to reduce them in the function xmlFAEliminateSimpleEpsilonTransitions.

There is an error there for this case:

* State 1 has a transition with an atom (in this case "a") to state 2.
* State 2 is final and has an epsilon transition to state 1.

After reduction it looked like:
* State 1 has a transition with an atom (in this case "a") to itself
  and is final.

In other words, the empty string is accepted when it shouldn't be.

The attached patch skips the reduction step for final states.
An alternative would be to insert or increment counters when reducing a
final state, but this seemed error prone and unnecessary, since there
aren't that many final states.

Fixes #282
1 file changed
tree: 8c88b5506b49798e1ddd50586db8f66d031f5474
  1. .gitattributes
  2. .gitignore
  3. .gitlab-ci.yml
  4. .travis.yml
  5. AUTHORS
  6. CMakeLists.txt
  7. CONTRIBUTING
  8. ChangeLog
  9. Copyright
  10. DOCBparser.c
  11. HTMLparser.c
  12. HTMLtree.c
  13. INSTALL.libxml2
  14. MAINTAINERS
  15. Makefile.am
  16. Makefile.tests
  17. Makefile.win
  18. NEWS
  19. README
  20. README.cvs-commits
  21. README.tests
  22. README.zOS
  23. SAX.c
  24. SAX2.c
  25. TODO
  26. TODO_SCHEMAS
  27. VxWorks/
  28. acinclude.m4
  29. autogen.sh
  30. bakefile/
  31. buf.c
  32. buf.h
  33. build_glob.py
  34. c14n.c
  35. catalog.c
  36. check-relaxng-test-suite.py
  37. check-relaxng-test-suite2.py
  38. check-xinclude-test-suite.py
  39. check-xml-test-suite.py
  40. check-xsddata-test-suite.py
  41. chvalid.c
  42. chvalid.def
  43. config.h.cmake.in
  44. configure.ac
  45. dbgen.pl
  46. dbgenattr.pl
  47. debugXML.c
  48. dict.c
  49. doc/
  50. elfgcchack.h
  51. enc.h
  52. encoding.c
  53. entities.c
  54. error.c
  55. example/
  56. fuzz/
  57. genChRanges.py
  58. genUnicode.py
  59. gentest.py
  60. global.data
  61. globals.c
  62. hash.c
  63. include/
  64. legacy.c
  65. libxml-2.0-uninstalled.pc.in
  66. libxml-2.0.pc.in
  67. libxml.3
  68. libxml.h
  69. libxml.m4
  70. libxml.spec.in
  71. libxml2-config.cmake.cmake.in
  72. libxml2-config.cmake.in
  73. libxml2.doap
  74. libxml2.syms
  75. list.c
  76. macos/
  77. nanoftp.c
  78. nanohttp.c
  79. optim/
  80. os400/
  81. parser.c
  82. parserInternals.c
  83. pattern.c
  84. python/
  85. regressions.py
  86. regressions.xml
  87. relaxng.c
  88. result/
  89. rngparser.c
  90. runsuite.c
  91. runtest.c
  92. runxmlconf.c
  93. save.h
  94. schematron.c
  95. test/
  96. testAutomata.c
  97. testC14N.c
  98. testHTML.c
  99. testModule.c
  100. testOOM.c
  101. testOOMlib.c
  102. testOOMlib.h
  103. testReader.c
  104. testRegexp.c
  105. testRelax.c
  106. testSAX.c
  107. testSchemas.c
  108. testThreads.c
  109. testURI.c
  110. testXPath.c
  111. testapi.c
  112. testchar.c
  113. testdict.c
  114. testdso.c
  115. testlimits.c
  116. testrecurse.c
  117. threads.c
  118. timsort.h
  119. tree.c
  120. trio.c
  121. trio.h
  122. triodef.h
  123. trionan.c
  124. trionan.h
  125. triop.h
  126. triostr.c
  127. triostr.h
  128. uri.c
  129. valid.c
  130. vms/
  131. win32/
  132. xinclude.c
  133. xlink.c
  134. xml2-config.1
  135. xml2-config.in
  136. xml2Conf.sh.in
  137. xmlIO.c
  138. xmlcatalog.c
  139. xmllint.c
  140. xmlmemory.c
  141. xmlmodule.c
  142. xmlreader.c
  143. xmlregexp.c
  144. xmlsave.c
  145. xmlschemas.c
  146. xmlschemastypes.c
  147. xmlstring.c
  148. xmlunicode.c
  149. xmlwriter.c
  150. xpath.c
  151. xpointer.c
  152. xstc/
  153. xzlib.c
  154. xzlib.h