testchar.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. /**
  2. * Test the UTF-8 decoding routines
  3. *
  4. * author: Daniel Veillard
  5. * copy: see Copyright for the status of this software.
  6. */
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <libxml/parser.h>
  10. #include <libxml/parserInternals.h>
  11. #include "buf.h"
  12. int lastError;
  13. static void errorHandler(void *unused, xmlErrorPtr err) {
  14. if ((unused == NULL) && (err != NULL) && (lastError == 0)) {
  15. lastError = err->code;
  16. }
  17. }
  18. char document1[100] = "<doc>XXXX</doc>";
  19. char document2[100] = "<doc foo='XXXX'/>";
  20. static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
  21. int len, char *data, int forbid1, int forbid2) {
  22. int i;
  23. xmlDocPtr res;
  24. for (i = 0;i <= 0xFF;i++) {
  25. lastError = 0;
  26. xmlCtxtReset(ctxt);
  27. data[0] = (char) i;
  28. res = xmlReadMemory(document, len, "test", NULL, 0);
  29. if ((i == forbid1) || (i == forbid2)) {
  30. if ((lastError == 0) || (res != NULL)) {
  31. fprintf(stderr,
  32. "Failed to detect invalid char for Byte 0x%02X: %c\n",
  33. i, i);
  34. return(1);
  35. }
  36. }
  37. else if ((i == '<') || (i == '&')) {
  38. if ((lastError == 0) || (res != NULL)) {
  39. fprintf(stderr,
  40. "Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
  41. return(1);
  42. }
  43. }
  44. else if (((i < 0x20) || (i >= 0x80)) &&
  45. (i != 0x9) && (i != 0xA) && (i != 0xD)) {
  46. if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
  47. fprintf(stderr,
  48. "Failed to detect invalid char for Byte 0x%02X\n", i);
  49. return(1);
  50. }
  51. }
  52. else if (res == NULL) {
  53. fprintf(stderr,
  54. "Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
  55. return(1);
  56. }
  57. if (res != NULL)
  58. xmlFreeDoc(res);
  59. }
  60. return(0);
  61. }
  62. static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
  63. int len, char *data) {
  64. int i, j;
  65. xmlDocPtr res;
  66. for (i = 0x80;i <= 0xFF;i++) {
  67. for (j = 0;j <= 0xFF;j++) {
  68. lastError = 0;
  69. xmlCtxtReset(ctxt);
  70. data[0] = (char) i;
  71. data[1] = (char) j;
  72. res = xmlReadMemory(document, len, "test", NULL, 0);
  73. /* if first bit of first char is set, then second bit must too */
  74. if ((i & 0x80) && ((i & 0x40) == 0)) {
  75. if ((lastError == 0) || (res != NULL)) {
  76. fprintf(stderr,
  77. "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
  78. i, j);
  79. return(1);
  80. }
  81. }
  82. /*
  83. * if first bit of first char is set, then second char first
  84. * bits must be 10
  85. */
  86. else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
  87. if ((lastError == 0) || (res != NULL)) {
  88. fprintf(stderr,
  89. "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
  90. i, j);
  91. return(1);
  92. }
  93. }
  94. /*
  95. * if using a 2 byte encoding then the value must be greater
  96. * than 0x80, i.e. one of bits 5 to 1 of i must be set
  97. */
  98. else if ((i & 0x80) && ((i & 0x1E) == 0)) {
  99. if ((lastError == 0) || (res != NULL)) {
  100. fprintf(stderr,
  101. "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
  102. i, j);
  103. return(1);
  104. }
  105. }
  106. /*
  107. * if third bit of first char is set, then the sequence would need
  108. * at least 3 bytes, but we give only 2 !
  109. */
  110. else if ((i & 0xE0) == 0xE0) {
  111. if ((lastError == 0) || (res != NULL)) {
  112. fprintf(stderr,
  113. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
  114. i, j);
  115. return(1);
  116. }
  117. }
  118. /*
  119. * We should see no error in remaining cases
  120. */
  121. else if ((lastError != 0) || (res == NULL)) {
  122. fprintf(stderr,
  123. "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
  124. return(1);
  125. }
  126. if (res != NULL)
  127. xmlFreeDoc(res);
  128. }
  129. }
  130. return(0);
  131. }
  132. /**
  133. * testDocumentRanges:
  134. *
  135. * Test the correct UTF8 character parsing in context of XML documents
  136. * Those are in-context injection tests checking the parser behaviour on
  137. * edge case values at different point in content, beginning and end of
  138. * CDATA in text or in attribute values.
  139. */
  140. static int testDocumentRanges(void) {
  141. xmlParserCtxtPtr ctxt;
  142. char *data;
  143. int test_ret = 0;
  144. /*
  145. * Set up a parsing context using the first document as
  146. * the current input source.
  147. */
  148. ctxt = xmlNewParserCtxt();
  149. if (ctxt == NULL) {
  150. fprintf(stderr, "Failed to allocate parser context\n");
  151. return(1);
  152. }
  153. printf("testing 1 byte char in document: 1");
  154. fflush(stdout);
  155. data = &document1[5];
  156. data[0] = ' ';
  157. data[1] = ' ';
  158. data[2] = ' ';
  159. data[3] = ' ';
  160. /* test 1 byte injection at beginning of area */
  161. test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
  162. data, -1, -1);
  163. printf(" 2");
  164. fflush(stdout);
  165. data[0] = ' ';
  166. data[1] = ' ';
  167. data[2] = ' ';
  168. data[3] = ' ';
  169. /* test 1 byte injection at end of area */
  170. test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
  171. data + 3, -1, -1);
  172. printf(" 3");
  173. fflush(stdout);
  174. data = &document2[10];
  175. data[0] = ' ';
  176. data[1] = ' ';
  177. data[2] = ' ';
  178. data[3] = ' ';
  179. /* test 1 byte injection at beginning of area */
  180. test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
  181. data, '\'', -1);
  182. printf(" 4");
  183. fflush(stdout);
  184. data[0] = ' ';
  185. data[1] = ' ';
  186. data[2] = ' ';
  187. data[3] = ' ';
  188. /* test 1 byte injection at end of area */
  189. test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
  190. data + 3, '\'', -1);
  191. printf(" done\n");
  192. printf("testing 2 byte char in document: 1");
  193. fflush(stdout);
  194. data = &document1[5];
  195. data[0] = ' ';
  196. data[1] = ' ';
  197. data[2] = ' ';
  198. data[3] = ' ';
  199. /* test 2 byte injection at beginning of area */
  200. test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
  201. data);
  202. printf(" 2");
  203. fflush(stdout);
  204. data[0] = ' ';
  205. data[1] = ' ';
  206. data[2] = ' ';
  207. data[3] = ' ';
  208. /* test 2 byte injection at end of area */
  209. test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
  210. data + 2);
  211. printf(" 3");
  212. fflush(stdout);
  213. data = &document2[10];
  214. data[0] = ' ';
  215. data[1] = ' ';
  216. data[2] = ' ';
  217. data[3] = ' ';
  218. /* test 2 byte injection at beginning of area */
  219. test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
  220. data);
  221. printf(" 4");
  222. fflush(stdout);
  223. data[0] = ' ';
  224. data[1] = ' ';
  225. data[2] = ' ';
  226. data[3] = ' ';
  227. /* test 2 byte injection at end of area */
  228. test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
  229. data + 2);
  230. printf(" done\n");
  231. xmlFreeParserCtxt(ctxt);
  232. return(test_ret);
  233. }
  234. static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
  235. int i = 0;
  236. int len, c;
  237. data[1] = 0;
  238. data[2] = 0;
  239. data[3] = 0;
  240. for (i = 0;i <= 0xFF;i++) {
  241. data[0] = (char) i;
  242. ctxt->charset = XML_CHAR_ENCODING_UTF8;
  243. lastError = 0;
  244. c = xmlCurrentChar(ctxt, &len);
  245. if ((i == 0) || (i >= 0x80)) {
  246. /* we must see an error there */
  247. if (lastError != XML_ERR_INVALID_CHAR) {
  248. fprintf(stderr,
  249. "Failed to detect invalid char for Byte 0x%02X\n", i);
  250. return(1);
  251. }
  252. } else if (i == 0xD) {
  253. if ((c != 0xA) || (len != 1)) {
  254. fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
  255. return(1);
  256. }
  257. } else if ((c != i) || (len != 1)) {
  258. fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
  259. return(1);
  260. }
  261. }
  262. return(0);
  263. }
  264. static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
  265. int i, j;
  266. int len, c;
  267. data[2] = 0;
  268. data[3] = 0;
  269. for (i = 0x80;i <= 0xFF;i++) {
  270. for (j = 0;j <= 0xFF;j++) {
  271. data[0] = (char) i;
  272. data[1] = (char) j;
  273. ctxt->charset = XML_CHAR_ENCODING_UTF8;
  274. lastError = 0;
  275. c = xmlCurrentChar(ctxt, &len);
  276. /* if first bit of first char is set, then second bit must too */
  277. if ((i & 0x80) && ((i & 0x40) == 0)) {
  278. if (lastError != XML_ERR_INVALID_CHAR) {
  279. fprintf(stderr,
  280. "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
  281. i, j);
  282. return(1);
  283. }
  284. }
  285. /*
  286. * if first bit of first char is set, then second char first
  287. * bits must be 10
  288. */
  289. else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
  290. if (lastError != XML_ERR_INVALID_CHAR) {
  291. fprintf(stderr,
  292. "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
  293. i, j, c);
  294. return(1);
  295. }
  296. }
  297. /*
  298. * if using a 2 byte encoding then the value must be greater
  299. * than 0x80, i.e. one of bits 5 to 1 of i must be set
  300. */
  301. else if ((i & 0x80) && ((i & 0x1E) == 0)) {
  302. if (lastError != XML_ERR_INVALID_CHAR) {
  303. fprintf(stderr,
  304. "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
  305. i, j, c);
  306. return(1);
  307. }
  308. }
  309. /*
  310. * if third bit of first char is set, then the sequence would need
  311. * at least 3 bytes, but we give only 2 !
  312. */
  313. else if ((i & 0xE0) == 0xE0) {
  314. if (lastError != XML_ERR_INVALID_CHAR) {
  315. fprintf(stderr,
  316. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
  317. i, j);
  318. return(1);
  319. }
  320. }
  321. /*
  322. * We should see no error in remaining cases
  323. */
  324. else if ((lastError != 0) || (len != 2)) {
  325. fprintf(stderr,
  326. "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
  327. return(1);
  328. }
  329. /*
  330. * Finally check the value is right
  331. */
  332. else if (c != (j & 0x3F) + ((i & 0x1F) << 6)) {
  333. fprintf(stderr,
  334. "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
  335. i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
  336. return(1);
  337. }
  338. }
  339. }
  340. return(0);
  341. }
  342. static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
  343. int i, j, k, K;
  344. int len, c;
  345. unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
  346. int value;
  347. data[3] = 0;
  348. for (i = 0xE0;i <= 0xFF;i++) {
  349. for (j = 0;j <= 0xFF;j++) {
  350. for (k = 0;k < 6;k++) {
  351. data[0] = (char) i;
  352. data[1] = (char) j;
  353. K = lows[k];
  354. data[2] = (char) K;
  355. value = (K & 0x3F) + ((j & 0x3F) << 6) + ((i & 0xF) << 12);
  356. ctxt->charset = XML_CHAR_ENCODING_UTF8;
  357. lastError = 0;
  358. c = xmlCurrentChar(ctxt, &len);
  359. /*
  360. * if fourth bit of first char is set, then the sequence would need
  361. * at least 4 bytes, but we give only 3 !
  362. */
  363. if ((i & 0xF0) == 0xF0) {
  364. if (lastError != XML_ERR_INVALID_CHAR) {
  365. fprintf(stderr,
  366. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
  367. i, j, K, data[3]);
  368. return(1);
  369. }
  370. }
  371. /*
  372. * The second and the third bytes must start with 10
  373. */
  374. else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
  375. if (lastError != XML_ERR_INVALID_CHAR) {
  376. fprintf(stderr,
  377. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
  378. i, j, K);
  379. return(1);
  380. }
  381. }
  382. /*
  383. * if using a 3 byte encoding then the value must be greater
  384. * than 0x800, i.e. one of bits 4 to 0 of i must be set or
  385. * the 6th byte of data[1] must be set
  386. */
  387. else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
  388. if (lastError != XML_ERR_INVALID_CHAR) {
  389. fprintf(stderr,
  390. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
  391. i, j, K);
  392. return(1);
  393. }
  394. }
  395. /*
  396. * There are values in that range that are not allowed in XML-1.0
  397. */
  398. else if (((value > 0xD7FF) && (value <0xE000)) ||
  399. ((value > 0xFFFD) && (value <0x10000))) {
  400. if (lastError != XML_ERR_INVALID_CHAR) {
  401. fprintf(stderr,
  402. "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
  403. value, i, j, K);
  404. return(1);
  405. }
  406. }
  407. /*
  408. * We should see no error in remaining cases
  409. */
  410. else if ((lastError != 0) || (len != 3)) {
  411. fprintf(stderr,
  412. "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
  413. i, j, K);
  414. return(1);
  415. }
  416. /*
  417. * Finally check the value is right
  418. */
  419. else if (c != value) {
  420. fprintf(stderr,
  421. "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
  422. i, j, data[2], value, c);
  423. return(1);
  424. }
  425. }
  426. }
  427. }
  428. return(0);
  429. }
  430. static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
  431. int i, j, k, K, l, L;
  432. int len, c;
  433. unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
  434. int value;
  435. data[4] = 0;
  436. for (i = 0xF0;i <= 0xFF;i++) {
  437. for (j = 0;j <= 0xFF;j++) {
  438. for (k = 0;k < 6;k++) {
  439. for (l = 0;l < 6;l++) {
  440. data[0] = (char) i;
  441. data[1] = (char) j;
  442. K = lows[k];
  443. data[2] = (char) K;
  444. L = lows[l];
  445. data[3] = (char) L;
  446. value = (L & 0x3F) + ((K & 0x3F) << 6) + ((j & 0x3F) << 12) +
  447. ((i & 0x7) << 18);
  448. ctxt->charset = XML_CHAR_ENCODING_UTF8;
  449. lastError = 0;
  450. c = xmlCurrentChar(ctxt, &len);
  451. /*
  452. * if fifth bit of first char is set, then the sequence would need
  453. * at least 5 bytes, but we give only 4 !
  454. */
  455. if ((i & 0xF8) == 0xF8) {
  456. if (lastError != XML_ERR_INVALID_CHAR) {
  457. fprintf(stderr,
  458. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
  459. i, j, K, data[3]);
  460. return(1);
  461. }
  462. }
  463. /*
  464. * The second, third and fourth bytes must start with 10
  465. */
  466. else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
  467. ((L & 0xC0) != 0x80)) {
  468. if (lastError != XML_ERR_INVALID_CHAR) {
  469. fprintf(stderr,
  470. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
  471. i, j, K, L);
  472. return(1);
  473. }
  474. }
  475. /*
  476. * if using a 3 byte encoding then the value must be greater
  477. * than 0x10000, i.e. one of bits 3 to 0 of i must be set or
  478. * the 6 or 5th byte of j must be set
  479. */
  480. else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
  481. if (lastError != XML_ERR_INVALID_CHAR) {
  482. fprintf(stderr,
  483. "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
  484. i, j, K, L);
  485. return(1);
  486. }
  487. }
  488. /*
  489. * There are values in that range that are not allowed in XML-1.0
  490. */
  491. else if (((value > 0xD7FF) && (value <0xE000)) ||
  492. ((value > 0xFFFD) && (value <0x10000)) ||
  493. (value > 0x10FFFF)) {
  494. if (lastError != XML_ERR_INVALID_CHAR) {
  495. fprintf(stderr,
  496. "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
  497. value, i, j, K, L);
  498. return(1);
  499. }
  500. }
  501. /*
  502. * We should see no error in remaining cases
  503. */
  504. else if ((lastError != 0) || (len != 4)) {
  505. fprintf(stderr,
  506. "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
  507. i, j, K);
  508. return(1);
  509. }
  510. /*
  511. * Finally check the value is right
  512. */
  513. else if (c != value) {
  514. fprintf(stderr,
  515. "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
  516. i, j, data[2], value, c);
  517. return(1);
  518. }
  519. }
  520. }
  521. }
  522. }
  523. return(0);
  524. }
  525. /**
  526. * testCharRanges:
  527. *
  528. * Test the correct UTF8 character parsing in isolation i.e.
  529. * not when parsing a full document, this is less expensive and we can
  530. * cover the full range of UTF-8 chars accepted by XML-1.0
  531. */
  532. static int testCharRanges(void) {
  533. char data[5];
  534. xmlParserCtxtPtr ctxt;
  535. xmlParserInputBufferPtr buf;
  536. xmlParserInputPtr input;
  537. int test_ret = 0;
  538. memset(data, 0, 5);
  539. /*
  540. * Set up a parsing context using the above data buffer as
  541. * the current input source.
  542. */
  543. ctxt = xmlNewParserCtxt();
  544. if (ctxt == NULL) {
  545. fprintf(stderr, "Failed to allocate parser context\n");
  546. return(1);
  547. }
  548. buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
  549. XML_CHAR_ENCODING_NONE);
  550. if (buf == NULL) {
  551. fprintf(stderr, "Failed to allocate input buffer\n");
  552. test_ret = 1;
  553. goto error;
  554. }
  555. input = xmlNewInputStream(ctxt);
  556. if (input == NULL) {
  557. xmlFreeParserInputBuffer(buf);
  558. test_ret = 1;
  559. goto error;
  560. }
  561. input->filename = NULL;
  562. input->buf = buf;
  563. input->cur =
  564. input->base = xmlBufContent(input->buf->buffer);
  565. input->end = input->base + 4;
  566. inputPush(ctxt, input);
  567. printf("testing char range: 1");
  568. fflush(stdout);
  569. test_ret += testCharRangeByte1(ctxt, data);
  570. printf(" 2");
  571. fflush(stdout);
  572. test_ret += testCharRangeByte2(ctxt, data);
  573. printf(" 3");
  574. fflush(stdout);
  575. test_ret += testCharRangeByte3(ctxt, data);
  576. printf(" 4");
  577. fflush(stdout);
  578. test_ret += testCharRangeByte4(ctxt, data);
  579. printf(" done\n");
  580. fflush(stdout);
  581. error:
  582. xmlFreeParserCtxt(ctxt);
  583. return(test_ret);
  584. }
  585. int main(void) {
  586. int ret = 0;
  587. /*
  588. * this initialize the library and check potential ABI mismatches
  589. * between the version it was compiled for and the actual shared
  590. * library used.
  591. */
  592. LIBXML_TEST_VERSION
  593. /*
  594. * Catch errors separately
  595. */
  596. xmlSetStructuredErrorFunc(NULL, errorHandler);
  597. /*
  598. * Run the tests
  599. */
  600. ret += testCharRanges();
  601. ret += testDocumentRanges();
  602. /*
  603. * Cleanup function for the XML library.
  604. */
  605. xmlCleanupParser();
  606. /*
  607. * this is to debug memory for regression tests
  608. */
  609. xmlMemoryDump();
  610. return(ret ? 1 : 0);
  611. }