Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
unwanted output while running layout tests
* kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
* kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
to standard output. I think we should arrange for the error text to be in JavaScript
exceptions instead at some point.
* kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
too-large size rather than allocating a buffer smaller than requested.
WebCore:
Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
unwanted output while running layout tests
* khtml/xsl/xsl_stylesheetimpl.cpp: (WebCore::XSLStyleSheetImpl::parseString):
Pass XML_PARSE_NOERROR and XML_PARSE_NOWARNING. We don't want errors and warnings
to be logged to stdout or stderr. If we later decide we want the error messages,
then we should do the additional work to put them into the web page or the
console (along with the JavaScript errors).
* platform/ArrayImpl.cpp: (WebCore::ArrayImpl::resize): Add a preflight to protect
against integer overflow due to large array size. Noticed this while looking into
the malloc error message.
WebKit:
Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
unwanted output while running layout tests
* WebView/WebDataSourcePrivate.h:
* WebView/WebDataSource.m:
(-[WebDataSource _setRepresentation:]): Clear the flag that records whether we've sent
all the data to the representation or not; need this to prevent telling the same representation
both that we've succeeded and then later that we've failed.
(-[WebDataSource _setMainDocumentError:]): Don't send an error if representationFinishedLoading
is already YES. Set representationFinishedLoading.
(-[WebDataSource _finishedLoading]): Set representationFinishedLoading.
(-[WebDataSource _setupForReplaceByMIMEType:]): Ditto.
WebKitTools:
Reviewed by Anders.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
unwanted output while running layout tests
* DumpRenderTree/DumpRenderTree.m:
(checkedMalloc): Added.
(checkedRealloc): Added.
(makeLargeMallocFailSilently): Added.
(main): Call makeLargeMallocFailSilently.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13203
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-03-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
+ unwanted output while running layout tests
+
+ * kjs/lexer.cpp: (Lexer::lex): Turn off the "yylex: ERROR" message.
+ * kjs/regexp.cpp: (KJS::RegExp::RegExp): Remove the code to log errors from PCRE
+ to standard output. I think we should arrange for the error text to be in JavaScript
+ exceptions instead at some point.
+ * kxmlcore/Vector.h: Add a check for overflow so that we'll abort if we pass a
+ too-large size rather than allocating a buffer smaller than requested.
+
2006-03-06 David Carson <dacarson@gmail.com>
Reviewed by Darin, landed by ap.
token = NUMBER;
break;
case Bad:
+#ifdef KJS_DEBUG_LEX
fprintf(stderr, "yylex: ERROR.\n");
+#endif
error = true;
return -1;
default:
char null(0);
nullTerminated.append(null);
_regex = pcre_compile(reinterpret_cast<const uint16_t *>(nullTerminated.data()), options, &errorMessage, &errorOffset, NULL);
- if (!_regex) {
-#ifndef NDEBUG
- fprintf(stderr, "KJS: pcre_compile() failed with '%s'\n", errorMessage);
-#endif
+ if (!_regex)
return;
- }
#ifdef PCRE_INFO_CAPTURECOUNT
// Get number of subpatterns that will be returned.
#define KXMLCORE_VECTOR_H
#include "Assertions.h"
+#include "VectorTraits.h"
+#include <limits>
#include <stdlib.h>
#include <utility>
-#include "VectorTraits.h"
namespace KXMLCore {
{
ASSERT(newCapacity >= m_capacity);
m_capacity = newCapacity;
+ if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+ abort();
m_buffer = reinterpret_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
}
+2006-03-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
+ unwanted output while running layout tests
+
+ * khtml/xsl/xsl_stylesheetimpl.cpp: (WebCore::XSLStyleSheetImpl::parseString):
+ Pass XML_PARSE_NOERROR and XML_PARSE_NOWARNING. We don't want errors and warnings
+ to be logged to stdout or stderr. If we later decide we want the error messages,
+ then we should do the additional work to put them into the web page or the
+ console (along with the JavaScript errors).
+
+ * platform/ArrayImpl.cpp: (WebCore::ArrayImpl::resize): Add a preflight to protect
+ against integer overflow due to large array size. Noticed this while looking into
+ the malloc error message.
+
2006-03-07 Darin Adler <darin@apple.com>
Reviewed by Adele.
if (!m_stylesheetDocTaken)
xmlFreeDoc(m_stylesheetDoc);
m_stylesheetDocTaken = false;
- m_stylesheetDoc = xmlReadMemory(reinterpret_cast<const char *>(string.unicode()),
- string.length() * sizeof(QChar),
- m_ownerDocument->URL().ascii(),
- BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
- XML_PARSE_NOCDATA|XML_PARSE_DTDATTR|XML_PARSE_NOENT);
+ m_stylesheetDoc = xmlReadMemory(reinterpret_cast<const char *>(string.unicode()), string.length() * sizeof(QChar),
+ m_ownerDocument->URL().ascii(),
+ BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
+ XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA);
loadChildSheets();
setLoaderForLibXMLCallbacks(0);
return m_stylesheetDoc;
#include "config.h"
#include "ArrayImpl.h"
-#include <stddef.h>
+#include <limits>
#include <new>
+#include <stddef.h>
#include <string.h>
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-using std::nothrow;
-
namespace WebCore {
ArrayImpl::ArrayPrivate::ArrayPrivate(size_t pItemSize, size_t pNumItems) :
char *newData;
if (newSize != 0) {
+ size_t maxSize = std::numeric_limits<size_t>::max() / d->itemSize;
+ if (newSize > maxSize)
+ return false;
newData = static_cast<char *>(fastRealloc(d->data, newSize * d->itemSize));
- if (newData == NULL) {
+ if (!newData)
return false;
- }
} else {
- newData = NULL;
+ newData = 0;
fastFree(d->data);
}
+2006-03-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
+ unwanted output while running layout tests
+
+ * WebView/WebDataSourcePrivate.h:
+ * WebView/WebDataSource.m:
+ (-[WebDataSource _setRepresentation:]): Clear the flag that records whether we've sent
+ all the data to the representation or not; need this to prevent telling the same representation
+ both that we've succeeded and then later that we've failed.
+ (-[WebDataSource _setMainDocumentError:]): Don't send an error if representationFinishedLoading
+ is already YES. Set representationFinishedLoading.
+ (-[WebDataSource _finishedLoading]): Set representationFinishedLoading.
+ (-[WebDataSource _setupForReplaceByMIMEType:]): Ditto.
+
2006-03-06 Tim Omernick <timo@apple.com>
Reviewed by Kevin Decker.
{
[_private->representation release];
_private->representation = [representation retain];
+ _private->representationFinishedLoading = NO;
}
- (void)_setLoading:(BOOL)loading
[_private->mainDocumentError release];
_private->mainDocumentError = error;
- [[self representation] receivedError:error withDataSource:self];
+ if (!_private->representationFinishedLoading) {
+ _private->representationFinishedLoading = YES;
+ [[self representation] receivedError:error withDataSource:self];
+ }
}
- (void)_clearErrors
_private->gotFirstByte = YES;
[self _commitIfReady];
+ _private->representationFinishedLoading = YES;
[[self representation] finishedLoadingWithDataSource:self];
- // Since we've sent openURL to the bridge, it's important to send end too, so that WebCore
- // can realize that the load is completed.
[[self _bridge] end];
}
[self _commitLoadWithData:[self data]];
}
+ _private->representationFinishedLoading = YES;
[[self representation] finishedLoadingWithDataSource:self];
[[self _bridge] end];
BOOL gotFirstByte; // got first byte
BOOL committed; // This data source has been committed
+ BOOL representationFinishedLoading;
BOOL defersCallbacks;
+2006-03-07 Darin Adler <darin@apple.com>
+
+ Reviewed by Anders.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7655
+ unwanted output while running layout tests
+
+ * DumpRenderTree/DumpRenderTree.m:
+ (checkedMalloc): Added.
+ (checkedRealloc): Added.
+ (makeLargeMallocFailSilently): Added.
+ (main): Call makeLargeMallocFailSilently.
+
2006-03-06 Darin Adler <darin@apple.com>
* Scripts/do-webcore-rename: Add some more planned renaming.
#import <CommonCrypto/CommonDigest.h> // for MD5 functions
#import <getopt.h>
+#import <malloc/malloc.h>
#import "TextInputController.h"
#import "NavigationController.h"
CFRelease(previousProfileName);
}
+static void* (*savedMalloc)(malloc_zone_t*, size_t);
+static void* (*savedRealloc)(malloc_zone_t*, void*, size_t);
+
+static void* checkedMalloc(malloc_zone_t* zone, size_t size)
+{
+ if (size >= 0x10000000)
+ return 0;
+ return savedMalloc(zone, size);
+}
+
+static void* checkedRealloc(malloc_zone_t* zone, void* ptr, size_t size)
+{
+ if (size >= 0x10000000)
+ return 0;
+ return savedRealloc(zone, ptr, size);
+}
+
+static void makeLargeMallocFailSilently(void)
+{
+ malloc_zone_t* zone = malloc_default_zone();
+ savedMalloc = zone->malloc;
+ savedRealloc = zone->realloc;
+ zone->malloc = checkedMalloc;
+ zone->realloc = checkedRealloc;
+}
+
int main(int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[window setAutodisplay:NO];
[webView setContinuousSpellCheckingEnabled:YES];
+
+ makeLargeMallocFailSilently();
// For reasons that are not entirely clear, the following pair of calls makes WebView handle its
// dynamic scrollbars properly. Without it, every frame will always have scrollbars.