VirtualBox

Changeset 42884 in vbox for trunk/src/libs


Ignore:
Timestamp:
Aug 20, 2012 1:35:06 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80169
Message:

libxml: patch from upstream

Location:
trunk/src/libs/libxml2-2.6.31
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/libxml2-2.6.31/include/libxml/xpath.h

    r39915 r42884  
    6969    XPATH_ENCODING_ERROR,
    7070    XPATH_INVALID_CHAR_ERROR,
    71     XPATH_INVALID_CTXT
     71    XPATH_INVALID_CTXT,
     72    XPATH_STACK_ERROR
    7273} xmlXPathError;
    7374
     
    378379    int xptr;                           /* it this an XPointer expression */
    379380    xmlNodePtr         ancestor;        /* used for walking preceding axis */
     381
     382    int              valueFrame;        /* used to limit Pop on the stack */
    380383};
    381384
  • trunk/src/libs/libxml2-2.6.31/xpath.c

    r39921 r42884  
    253253    "Char out of XML range\n",
    254254    "Invalid or incomplete context\n",
     255    "Stack usage errror\n",
    255256    "?? Unknown error ??\n"     /* Must be last in the list! */
    256257};
     
    23992400
    24002401/**
     2402 * xmlXPathSetFrame:
     2403 * @ctxt: an XPath parser context
     2404 *
     2405 * Set the callee evaluation frame
     2406 *
     2407 * Returns the previous frame value to be restored once done
     2408 */
     2409static int
     2410xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
     2411    int ret;
     2412
     2413    if (ctxt == NULL)
     2414        return(0);
     2415    ret = ctxt->valueFrame;
     2416    ctxt->valueFrame = ctxt->valueNr;
     2417    return(ret);
     2418}
     2419
     2420/**
     2421 * xmlXPathPopFrame:
     2422 * @ctxt: an XPath parser context
     2423 * @frame: the previous frame value
     2424 *
     2425 * Remove the callee evaluation frame
     2426 */
     2427static void
     2428xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
     2429    if (ctxt == NULL)
     2430        return;
     2431    if (ctxt->valueNr < ctxt->valueFrame) {
     2432        xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
     2433    }
     2434    ctxt->valueFrame = frame;
     2435}
     2436
     2437/**
    24012438 * valuePop:
    24022439 * @ctxt: an XPath evaluation context
     
    24132450    if ((ctxt == NULL) || (ctxt->valueNr <= 0))
    24142451        return (NULL);
     2452
     2453    if (ctxt->valueNr <= ctxt->valueFrame) {
     2454        xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
     2455        return (NULL);
     2456    }
     2457
    24152458    ctxt->valueNr--;
    24162459    if (ctxt->valueNr > 0)
     
    61376180    ret->valueMax = 10;
    61386181    ret->value = NULL;
     6182    ret->valueFrame = 0;
    61396183
    61406184    ret->context = ctxt;
     
    1167411718        xmlNodePtr oldContextNode, contextNode = NULL;
    1167511719        xmlXPathContextPtr xpctxt = ctxt->context;
     11720        int frame;
    1167611721
    1167711722#ifdef LIBXML_XPTR_ENABLED
     
    1169311738        exprOp = &ctxt->comp->steps[op->ch2];
    1169411739        for (i = 0; i < set->nodeNr; i++) {
     11740            xmlXPathObjectPtr tmp;
     11741
    1169511742            if (set->nodeTab[i] == NULL)
    1169611743                continue;
     
    1172011767                    contextNode);
    1172111768
     11769            frame = xmlXPathSetFrame(ctxt);
    1172211770            valuePush(ctxt, contextObj);
    1172311771            res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
    11724            
     11772            tmp = valuePop(ctxt);
     11773            xmlXPathPopFrame(ctxt, frame);
     11774
    1172511775            if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
    11726                 xmlXPathObjectPtr tmp;
    11727                 /* pop the result */
    11728                 tmp = valuePop(ctxt);
    11729                 xmlXPathReleaseObject(xpctxt, tmp);
    11730                 /* then pop off contextObj, which will be freed later */
    11731                 valuePop(ctxt);
     11776                while (tmp != contextObj) {
     11777                    /*
     11778                     * Free up the result
     11779                     * then pop off contextObj, which will be freed later
     11780                     */
     11781                    xmlXPathReleaseObject(xpctxt, tmp);
     11782                    tmp = valuePop(ctxt);
     11783                }
    1173211784                goto evaluation_error;
    1173311785            }
     11786            /* push the result back onto the stack */
     11787            valuePush(ctxt, tmp);
    1173411788
    1173511789            if (res)
     
    1333513389                const xmlChar *oldFunc, *oldFuncURI;
    1333613390                int i;
    13337 
     13391                int frame;
     13392
     13393                frame = xmlXPathSetFrame(ctxt);
    1333813394                if (op->ch1 != -1)
    1333913395                    total +=
     
    1334313399                            "xmlXPathCompOpEval: parameter error\n");
    1334413400                    ctxt->error = XPATH_INVALID_OPERAND;
     13401                    xmlXPathPopFrame(ctxt, frame);
    1334513402                    return (total);
    1334613403                }
    13347                 for (i = 0; i < op->value; i++)
     13404                for (i = 0; i < op->value; i++) {
    1334813405                    if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
    1334913406                        xmlGenericError(xmlGenericErrorContext,
    1335013407                                "xmlXPathCompOpEval: parameter error\n");
    1335113408                        ctxt->error = XPATH_INVALID_OPERAND;
     13409                        xmlXPathPopFrame(ctxt, frame);
    1335213410                        return (total);
    1335313411                    }
     13412                }
    1335413413                if (op->cache != NULL)
    1335513414                    XML_CAST_FPTR(func) = op->cache;
     
    1338913448                ctxt->context->function = oldFunc;
    1339013449                ctxt->context->functionURI = oldFuncURI;
     13450                xmlXPathPopFrame(ctxt, frame);
    1339113451                return (total);
    1339213452            }
     
    1429314353        ctxt->valueMax = 10;
    1429414354        ctxt->value = NULL;
     14355        ctxt->valueFrame = 0;
    1429514356    }
    1429614357#ifdef XPATH_STREAMING
  • trunk/src/libs/libxml2-2.6.31/xpointer.c

    r42883 r42884  
    12611261        ctxt->valueMax = 10;
    12621262        ctxt->value = NULL;
     1263        ctxt->valueFrame = 0;
    12631264    }
    12641265    SKIP_BLANKS;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette