~ubuntu-branches/ubuntu/precise/libxml2/precise-security

« back to all changes in this revision

Viewing changes to error.c

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-01-19 11:59:30 UTC
  • Revision ID: package-import@ubuntu.com-20120119115930-76q45my8l8ynfa8b
Tags: 2.7.8.dfsg-5.1ubuntu3
* various fixes for __xmlRaiseError (LP: #686363). This can be dropped in
  2.7.8.dfsg-6
  - 111d705c282e03e7202723c6c7e4499f8582bd4f
  - 1b9128bae737fa559f5e2c191d6679a856efbad9
  - 241d4a1069e6bedd0ee2295d7b43858109c1c6d1
  - c2a0fdc4e6d106690d7fd8fa1677e133c94e155d

Show diffs side-by-side

added added

removed removed

Lines of Context:
452
452
    xmlErrorPtr to = &xmlLastError;
453
453
    xmlNodePtr baseptr = NULL;
454
454
 
 
455
    if (code == XML_ERR_OK)
 
456
        return;
455
457
    if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
456
458
        return;
457
459
    if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
459
461
        (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
460
462
        ctxt = (xmlParserCtxtPtr) ctx;
461
463
        if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
462
 
            (ctxt->sax->initialized == XML_SAX2_MAGIC))
 
464
            (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
 
465
            (ctxt->sax->serror != NULL)) {
463
466
            schannel = ctxt->sax->serror;
 
467
            data = ctxt->userData;
 
468
        }
464
469
    }
465
470
    /*
466
471
     * Check if structured error handler set
473
478
        if (schannel != NULL)
474
479
            data = xmlStructuredErrorContext;
475
480
    }
476
 
    if ((domain == XML_FROM_VALID) &&
477
 
        ((channel == xmlParserValidityError) ||
478
 
         (channel == xmlParserValidityWarning))) {
479
 
        ctxt = (xmlParserCtxtPtr) ctx;
480
 
        if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
481
 
            (ctxt->sax->initialized == XML_SAX2_MAGIC))
482
 
            schannel = ctxt->sax->serror;
483
 
    }
484
 
    if (code == XML_ERR_OK)
485
 
        return;
486
481
    /*
487
482
     * Formatting the message
488
483
     */
589
584
    if (to != &xmlLastError)
590
585
        xmlCopyError(to,&xmlLastError);
591
586
 
 
587
    if (schannel != NULL) {
 
588
        schannel(data, to);
 
589
        return;
 
590
    }
 
591
 
592
592
    /*
593
593
     * Find the callback channel if channel param is NULL
594
594
     */
600
600
            channel = ctxt->sax->error;
601
601
        data = ctxt->userData;
602
602
    } else if (channel == NULL) {
603
 
        if ((schannel == NULL) && (xmlStructuredError != NULL)) {
604
 
            schannel = xmlStructuredError;
605
 
            data = xmlStructuredErrorContext;
606
 
        } else {
607
 
            channel = xmlGenericError;
608
 
            if (!data) {
609
 
                data = xmlGenericErrorContext;
610
 
            }
611
 
        }
612
 
    }
613
 
    if (schannel != NULL) {
614
 
        schannel(data, to);
615
 
        return;
 
603
        channel = xmlGenericError;
 
604
        if (!data)
 
605
            data = xmlGenericErrorContext;
616
606
    }
617
607
    if (channel == NULL)
618
608
        return;