ALT Linux Bugzilla
– Attachment 4742 Details for
Bug 24379
xmlSetStructuredErrorFunc() breaks SAX2 error handler
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
Исправленый testcase
t.c (text/plain), 1.64 KB, created by
serpiph
on 2011-01-09 10:01:48 MSK
(
hide
)
Description:
Исправленый testcase
Filename:
MIME Type:
Creator:
serpiph
Created:
2011-01-09 10:01:48 MSK
Size:
1.64 KB
patch
obsolete
>#include <stdlib.h> >#include <string.h> > >#include <libxml/parser.h> >#include <libxml/parserInternals.h> >#include <libxml/debugXML.h> >#include <libxml/xmlversion.h> >#include <libxml/xmlmemory.h> >#include <libxml/xpath.h> >#include <libxml/valid.h> >#include <libxml/catalog.h> >#include <libxml/HTMLparser.h> >#include <libxml/xmlreader.h> > > >static void structured_error_callback(void *ctx, xmlErrorPtr xerror) >{ > printf("SEC: %p\n", ctx); >} > >static void structuredErrorFunc(void *userData, xmlErrorPtr xerror) >{ > printf("SEF: %p\n", userData); >} > >xmlSAXHandler sax_handler = { > 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, > XML_SAX2_MAGIC, > 0, 0, 0, 0 >}; > >int main(int argc, char *argv[]) >{ > char a[] = "true"; > > if (argc != 4) { > printf("usage: %s XML SET_ERR_FUNC SET_CONTEXT_ERR_FUNC\n", argv[0]); > exit(1); > } > > xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(argv[1], strlen(argv[1])); > > if (!strcmp(argv[2], a)) { > printf("Setting xmlSetStructuredErrorFunc()\n"); > xmlSetStructuredErrorFunc((void *)0xbadf00d, structuredErrorFunc); > } > > ctxt->sax2 = 1; > ctxt->userData = (void*)0xdeadbeef; > > if (ctxt->sax && ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler) > xmlFree(ctxt->sax); > > ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(sax_handler)); > if (ctxt->sax == NULL) { > printf("ENOMEM\n"); > exit(1); > } > > memcpy(ctxt->sax, &sax_handler, sizeof(sax_handler)); > > if (!strcmp(argv[3], a)) { > printf("Setting ctxt->sax->serror\n"); > ctxt->sax->serror = (xmlStructuredErrorFunc) structured_error_callback; > } > > xmlParseDocument(ctxt); > > if (ctxt->myDoc) > xmlFreeDoc(ctxt->myDoc); > > xmlFreeParserCtxt(ctxt); > > exit(0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 24379
:
4726
|
4728
|
4731
|
4732
|
4733
| 4742