ALT Linux Bugzilla
– Attachment 4726 Details for
Bug 24379
xmlSetStructuredErrorFunc() breaks SAX2 error handler
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
t.c
t.c (text/plain), 1.44 KB, created by
Sir Raorn
on 2010-12-29 14:18:43 MSK
(
hide
)
Description:
t.c
Filename:
MIME Type:
Creator:
Sir Raorn
Created:
2010-12-29 14:18:43 MSK
Size:
1.44 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: 0x%p\n", ctx); >} > >static void structuredErrorFunc(void *userData, xmlErrorPtr xerror) >{ > printf("SEF: 0x%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, > (xmlStructuredErrorFunc) structured_error_callback >}; > >int main(int argc, char *argv[]){ > > if (argc < 2) { > printf("usage: %s XML [SET_ERR_FUNC]\n", argv[0]); > exit(1); > } > > xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(argv[1], strlen(argv[1])); > > if (argc > 2) > 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)); > > 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