Came across this when trying to figure out how xmlstarlet works.
hadoop-policy.xml is standard hadoop 1.3 policy file but I am able to repoduce the issue with other xml files as well.
[14:04:17][ppershing@nslrack05: /opt/hadoop/hadoop/conf ]>xmlstarlet val hadoop-policy.xml
hadoop-policy.xml - valid
[14:04:20][ppershing@nslrack05: /opt/hadoop/hadoop/conf ]>xmlstarlet ed -d '/' hadoop-policy.xml
output error : string is not in UTF-8
output error : string is not in UTF-8
output error : string is not in UTF-8
xmlEscapeEntities : char out of range
xmlEscapeEntities : char out of range
xmlEscapeEntities : char out of range
xmlEscapeEntities : char out of range
output error : string is not in UTF-8
xmlEscapeEntities : char out of range
output error : string is not in UTF-8
<?xml version="1.0"?>
<�K�></�K�>
<></>
<���>
</>
<�K�>
<�K�>𦊁</�K�>
<�K�></�K�>
<�K�>𦊁</�K�>
</�K�>
<@��>
<@��>𦊁</@��>
<@��>=ʁ</@��>
<@��>𦊁</@��>
</@��>
<��>
<��>𦊁</��>
<��></��>
<��>𦊁</��>
</��>
<P��>
<P��>𦊁</P��>
<P��></P��>
<P��>𦊁</P��>
</P��>
<���>
<���>𦊁</���>
<���></���>
<���>𦊁</���>
</���>
<p��>
<p��>𦊁</p��>
<p��></p��>
<p��>𦊁</p��>
</p��>
<��>
<��>𦊁</��>
<��></��>
<��>𦊁</��>
</��>
<���>
<���>𦊁</���>
<���></���>
<���></���>
</���>
<��>
<���> Hʁ</���>
<���>𤊁</���>
<��>ACL for AdminOperationsProtocol, used by the mradmins commands
to refresh queues and nodes at JobTracker. The ACL is a comma-separated list of
user and group names. The user and group list is separated by a blank.
For e.g. "alice,bob users,wheel". A special value of "*" means all users are
allowed.</��>
</��>
</���>
*** glibc detected *** xmlstarlet: double free or corruption (!prev): 0x0000000001cab1c0 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71e16)[0x7f68f2c68e16]
/lib/libc.so.6(cfree+0x6c)[0x7f68f2c6db8c]
/usr/lib/libxml2.so.2(xmlFreeNodeList+0x160)[0x7f68f2fb0de0]
/usr/lib/libxml2.so.2(xmlFreeDoc+0xb8)[0x7f68f2fb0b38]
xmlstarlet[0x4050d7]
xmlstarlet[0x403cf1]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f68f2c15c8d]
xmlstarlet[0x403b39]
======= Memory map: ========
00400000-00413000 r-xp 00000000 08:01 4543261 /usr/bin/xmlstarlet
00612000-00613000 rw-p 00012000 08:01 4543261 /usr/bin/xmlstarlet
00613000-0065c000 rw-p 00000000 00:00 0
01ca1000-01cc2000 rw-p 00000000 00:00 0 [heap]
7f68ec000000-7f68ec021000 rw-p 00000000 00:00 0
7f68ec021000-7f68f0000000 ---p 00000000 00:00 0
7f68f1ec9000-7f68f1edf000 r-xp 00000000 08:01 3612936 /lib/libgcc_s.so.1
7f68f1edf000-7f68f20de000 ---p 00016000 08:01 3612936 /lib/libgcc_s.so.1
7f68f20de000-7f68f20df000 rw-p 00015000 08:01 3612936 /lib/libgcc_s.so.1
7f68f20df000-7f68f20e2000 r-xp 00000000 08:01 4539664 /usr/lib/libgpg-error.so.0.4.0
7f68f20e2000-7f68f22e1000 ---p 00003000 08:01 4539664 /usr/lib/libgpg-error.so.0.4.0
7f68f22e1000-7f68f22e2000 rw-p 00002000 08:01 4539664 /usr/lib/libgpg-error.so.0.4.0
7f68f22e2000-7f68f22f9000 r-xp 00000000 08:01 4539921 /usr/lib/libz.so.1.2.3.4
7f68f22f9000-7f68f24f8000 ---p 00017000 08:01 4539921 /usr/lib/libz.so.1.2.3.4
7f68f24f8000-7f68f24f9000 rw-p 00016000 08:01 4539921 /usr/lib/libz.so.1.2.3.4
7f68f24f9000-7f68f24fb000 r-xp 00000000 08:01 3613110 /lib/libdl-2.11.3.so
7f68f24fb000-7f68f26fb000 ---p 00002000 08:01 3613110 /lib/libdl-2.11.3.so
7f68f26fb000-7f68f26fc000 r--p 00002000 08:01 3613110 /lib/libdl-2.11.3.so
7f68f26fc000-7f68f26fd000 rw-p 00003000 08:01 3613110 /lib/libdl-2.11.3.so
7f68f26fd000-7f68f277d000 r-xp 00000000 08:01 3613111 /lib/libm-2.11.3.so
7f68f277d000-7f68f297d000 ---p 00080000 08:01 3613111 /lib/libm-2.11.3.so
7f68f297d000-7f68f297e000 r--p 00080000 08:01 3613111 /lib/libm-2.11.3.so
7f68f297e000-7f68f297f000 rw-p 00081000 08:01 3613111 /lib/libm-2.11.3.so
7f68f297f000-7f68f29f3000 r-xp 00000000 08:01 4539666 /usr/lib/libgcrypt.so.11.5.3
7f68f29f3000-7f68f2bf3000 ---p 00074000 08:01 4539666 /usr/lib/libgcrypt.so.11.5.3
7f68f2bf3000-7f68f2bf7000 rw-p 00074000 08:01 4539666 /usr/lib/libgcrypt.so.11.5.3
7f68f2bf7000-7f68f2d50000 r-xp 00000000 08:01 3613098 /lib/libc-2.11.3.so
7f68f2d50000-7f68f2f4f000 ---p 00159000 08:01 3613098 /lib/libc-2.11.3.so
7f68f2f4f000-7f68f2f53000 r--p 00158000 08:01 3613098 /lib/libc-2.11.3.so
7f68f2f53000-7f68f2f54000 rw-p 0015c000 08:01 3613098 /lib/libc-2.11.3.so
7f68f2f54000-7f68f2f59000 rw-p 00000000 00:00 0
7f68f2f59000-7f68f30a0000 r-xp 00000000 08:01 4539745 /usr/lib/libxml2.so.2.7.8
7f68f30a0000-7f68f329f000 ---p 00147000 08:01 4539745 /usr/lib/libxml2.so.2.7.8
7f68f329f000-7f68f32a8000 rw-p 00146000 08:01 4539745 /usr/lib/libxml2.so.2.7.8
7f68f32a8000-7f68f32aa000 rw-p 00000000 00:00 0
7f68f32aa000-7f68f32e5000 r-xp 00000000 08:01 4543257 /usr/lib/libxslt.so.1.1.26
7f68f32e5000-7f68f34e4000 ---p 0003b000 08:01 4543257 /usr/lib/libxslt.so.1.1.26
7f68f34e4000-7f68f34e6000 rw-p 0003a000 08:01 4543257 /usr/lib/libxslt.so.1.1.26
7f68f34e6000-7f68f34f9000 r-xp 00000000 08:01 4543256 /usr/lib/libexslt.so.0.8.15
7f68f34f9000-7f68f36f9000 ---p 00013000 08:01 4543256 /usr/lib/libexslt.so.0.8.15
7f68f36f9000-7f68f36fa000 rw-p 00013000 08:01 4543256 /usr/lib/libexslt.so.0.8.15
7f68f36fa000-7f68f3718000 r-xp 00000000 08:01 3613094 /lib/ld-2.11.3.so
7f68f3908000-7f68f390e000 rw-p 00000000 00:00 0
7f68f3914000-7f68f3917000 rw-p 00000000 00:00 0
7f68f3917000-7f68f3918000 r--p 0001d000 08:01 3613094 /lib/ld-2.11.3.so
7f68f3918000-7f68f3919000 rw-p 0001e000 08:01 3613094 /lib/ld-2.11.3.so
7f68f3919000-7f68f391a000 rw-p 00000000 00:00 0
7fff65b20000-7fff65b35000 rw-p 00000000 00:00 0 [stack]
7fff65bff000-7fff65c00000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted
Thanks for the report, I added a check for this and other modifications to the document node.
Fixed in commit e7543c2f62830fe426094338bffe9d451622fb07