From c8f8269bbed43ca8f1f4a8a7a65d6447221e2fd3 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Tue, 9 May 2000 06:31:54 +0000 Subject: [PATCH] ensure that source buffer is always terminated by a uni::null (which isn't automatically true for basic_string). git-svn-id: svn://10.0.0.236/trunk@68828 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/js2/parser.cpp | 1 + mozilla/js/js2/parser.h | 2 +- mozilla/js2/src/parser.cpp | 1 + mozilla/js2/src/parser.h | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mozilla/js/js2/parser.cpp b/mozilla/js/js2/parser.cpp index 5dd3beda467..41146fcb605 100644 --- a/mozilla/js/js2/parser.cpp +++ b/mozilla/js/js2/parser.cpp @@ -39,6 +39,7 @@ JS::Reader::Reader(const String &source, const String &sourceLocation, uint32 in begin = b; p = b; end = b + Reader::source.size(); + Reader::source.append(uni::null); // ensure last character is always '\0' #ifdef DEBUG recordString = 0; #endif diff --git a/mozilla/js/js2/parser.h b/mozilla/js/js2/parser.h index 3156002aef1..74b93bde1d4 100644 --- a/mozilla/js/js2/parser.h +++ b/mozilla/js/js2/parser.h @@ -40,7 +40,7 @@ namespace JavaScript { const char16 *p; // Position in source text const char16 *end; // End of source text; *end is a null character public: - const String source; // Source text + String source; // Source text const String sourceLocation; // Description of location from which the source text came private: const uint32 initialLineNum; // One-based number of current line diff --git a/mozilla/js2/src/parser.cpp b/mozilla/js2/src/parser.cpp index 5dd3beda467..41146fcb605 100644 --- a/mozilla/js2/src/parser.cpp +++ b/mozilla/js2/src/parser.cpp @@ -39,6 +39,7 @@ JS::Reader::Reader(const String &source, const String &sourceLocation, uint32 in begin = b; p = b; end = b + Reader::source.size(); + Reader::source.append(uni::null); // ensure last character is always '\0' #ifdef DEBUG recordString = 0; #endif diff --git a/mozilla/js2/src/parser.h b/mozilla/js2/src/parser.h index 3156002aef1..74b93bde1d4 100644 --- a/mozilla/js2/src/parser.h +++ b/mozilla/js2/src/parser.h @@ -40,7 +40,7 @@ namespace JavaScript { const char16 *p; // Position in source text const char16 *end; // End of source text; *end is a null character public: - const String source; // Source text + String source; // Source text const String sourceLocation; // Description of location from which the source text came private: const uint32 initialLineNum; // One-based number of current line