malloc-fail: Fix OOB read after xmlRegGetCounter

Found with libFuzzer, see #344.

(cherry picked from commit 1743c4c3fc58cf38ecce68db9de51d0f3651e033)

I also copied the error label from
e64653c0e7975594e27d7de2ed4be062c1e4ad03 to fix the build failure.

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