Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 143903018: Fixed crash on Android tcmalloc builds caused by vasprintf being incompatible to tcmalloc (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 if (!m_leafTextNode) 1096 if (!m_leafTextNode)
1097 enterText(); 1097 enterText();
1098 m_bufferedText.append(chars, length); 1098 m_bufferedText.append(chars, length);
1099 } 1099 }
1100 1100
1101 void XMLDocumentParser::error(XMLErrors::ErrorType type, const char* message, va _list args) 1101 void XMLDocumentParser::error(XMLErrors::ErrorType type, const char* message, va _list args)
1102 { 1102 {
1103 if (isStopped()) 1103 if (isStopped())
1104 return; 1104 return;
1105 1105
1106 #if HAVE(VASPRINTF)
1107 char* formattedMessage;
1108 if (vasprintf(&formattedMessage, message, args) == -1)
1109 return;
1110 #else
1111 char formattedMessage[1024]; 1106 char formattedMessage[1024];
1112 vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args); 1107 vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args);
1113 #endif
1114 1108
1115 if (m_parserPaused) { 1109 if (m_parserPaused) {
1116 m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinte rpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); 1110 m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinte rpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber())));
1117 #if HAVE(VASPRINTF)
1118 free(formattedMessage);
1119 #endif
1120 return; 1111 return;
1121 } 1112 }
1122 1113
1123 handleError(type, formattedMessage, textPosition()); 1114 handleError(type, formattedMessage, textPosition());
1124
1125 #if HAVE(VASPRINTF)
1126 free(formattedMessage);
1127 #endif
1128 } 1115 }
1129 1116
1130 void XMLDocumentParser::processingInstruction(const String& target, const String & data) 1117 void XMLDocumentParser::processingInstruction(const String& target, const String & data)
1131 { 1118 {
1132 if (isStopped()) 1119 if (isStopped())
1133 return; 1120 return;
1134 1121
1135 if (m_parserPaused) { 1122 if (m_parserPaused) {
1136 m_pendingCallbacks.append(adoptPtr(new PendingProcessingInstructionCallb ack(target ,data))); 1123 m_pendingCallbacks.append(adoptPtr(new PendingProcessingInstructionCallb ack(target ,data)));
1137 return; 1124 return;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 sax.initialized = XML_SAX2_MAGIC; 1619 sax.initialized = XML_SAX2_MAGIC;
1633 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1620 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1634 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1621 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1635 parseChunk(parser->context(), parseString); 1622 parseChunk(parser->context(), parseString);
1636 finishParsing(parser->context()); 1623 finishParsing(parser->context());
1637 attrsOK = state.gotAttributes; 1624 attrsOK = state.gotAttributes;
1638 return state.attributes; 1625 return state.attributes;
1639 } 1626 }
1640 1627
1641 } // namespace WebCore 1628 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698