~ubuntu-branches/ubuntu/precise/libxslt/precise-updates

« back to all changes in this revision

Viewing changes to libxslt/templates.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-09-28 15:13:38 UTC
  • mfrom: (28.1.1 precise-proposed)
  • Revision ID: package-import@ubuntu.com-20120928151338-yfhkskiueudfqcl0
Tags: 1.1.26-8ubuntu1.2
* SECURITY UPDATE: denial of service via out-of-bounds read
  - libxslt/pattern.c: fix improper loop exit.
  - fe5a4fa33eb85bce3253ed3742b1ea6c4b59b41b
  - CVE-2011-3970
* SECURITY UPDATE: denial of service via out-of-bounds read
  - libxslt/xsltutils.h: check for XML_ELEMENT_NODE
  - e6a0bc8081271f33b9899eb78e1da1a2a0428419
  - CVE-2012-2825
* SECURITY UPDATE: denial of service via crafted XSLT expression
  - harden code in libexslt/functions.c, libxslt/attributes.c,
    libxslt/functions.c, libxslt/pattern.c, libxslt/preproc.c,
    libxslt/templates.c, libxslt/transform.c, libxslt/variables.c,
    libxslt/xslt.c, libxslt/xsltutils.c.
  - 8566ab4a10158d195adb5f1f61afe1ee8bfebd12
  - 4da0f7e207f14a03daad4663865c285eb27f93e9
  - 24653072221e76d2f1f06aa71225229b532f8946
  - 1564b30e994602a95863d9716be83612580a2fed
  - CVE-2012-2870
* SECURITY UPDATE: denial of service and possible code execution during
  handling of XSL transforms
  - libxslt/transform.c: check for XML_NAMESPACE_DECL
  - 937ba2a3eb42d288f53c8adc211bd1122869f0bf
  - CVE-2012-2871
* SECURITY UPDATE: denial of service and possible code execution via
  double free during XSL transforms
  - libxslt/templates.c: Fix dictionary string usage
  - 54977ed7966847e305a2008cb18892df26eeb065
  - CVE-2012-2893

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <libxml/globals.h>
19
19
#include <libxml/xmlerror.h>
20
20
#include <libxml/tree.h>
 
21
#include <libxml/dict.h>
21
22
#include <libxml/xpathInternals.h>
22
23
#include <libxml/parserInternals.h>
23
24
#include "xslt.h"
198
199
    xmlNodePtr oldInsert, insert = NULL;
199
200
    xmlChar *ret;
200
201
 
201
 
    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
 
202
    if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
 
203
        (inst->type != XML_ELEMENT_NODE))
202
204
        return(NULL);
203
205
 
204
206
    if (inst->children == NULL)
380
382
    xmlChar *ret;
381
383
    xmlChar *expr;
382
384
 
383
 
    if ((ctxt == NULL) || (inst == NULL) || (name == NULL))
 
385
    if ((ctxt == NULL) || (inst == NULL) || (name == NULL) ||
 
386
        (inst->type != XML_ELEMENT_NODE))
384
387
        return(NULL);
385
388
 
386
389
    expr = xsltGetNsProp(inst, name, ns);
424
427
    const xmlChar *ret;
425
428
    xmlChar *expr;
426
429
 
427
 
    if ((style == NULL) || (inst == NULL) || (name == NULL))
 
430
    if ((style == NULL) || (inst == NULL) || (name == NULL) ||
 
431
        (inst->type != XML_ELEMENT_NODE))
428
432
        return(NULL);
429
433
 
430
434
    expr = xsltGetNsProp(inst, name, ns);
465
469
    const xmlChar *value;
466
470
    xmlAttrPtr ret;
467
471
 
468
 
    if ((ctxt == NULL) || (attr == NULL) || (target == NULL))
 
472
    if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
 
473
        (target->type != XML_ELEMENT_NODE))
469
474
        return(NULL);
470
475
    
471
476
    if (attr->type != XML_ATTRIBUTE_NODE)
572
577
                }
573
578
            } else if ((ctxt->internalized) && (target != NULL) &&
574
579
                       (target->doc != NULL) &&
575
 
                       (target->doc->dict == ctxt->dict)) {
 
580
                       (target->doc->dict == ctxt->dict) &&
 
581
                       xmlDictOwns(ctxt->dict, value)) {
576
582
                text->content = (xmlChar *) value;
577
583
            } else {
578
584
                text->content = xmlStrdup(value);
622
628
    const xmlChar *value;
623
629
    xmlChar *valueAVT;
624
630
 
625
 
    if ((ctxt == NULL) || (target == NULL) || (attrs == NULL))
 
631
    if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) ||
 
632
        (target->type != XML_ELEMENT_NODE))
626
633
        return(NULL);
627
634
 
628
635
    oldInsert = ctxt->insert;
757
764
                }
758
765
            } else if ((ctxt->internalized) &&
759
766
                (target->doc != NULL) &&
760
 
                (target->doc->dict == ctxt->dict))
 
767
                (target->doc->dict == ctxt->dict) &&
 
768
                xmlDictOwns(ctxt->dict, value))
761
769
            {
762
770
                text->content = (xmlChar *) value;
763
771
            } else {