From 7fc82df75eceff81b3e99a4e1cea7b9cbb255cf9 Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Thu, 3 Jun 2010 15:52:22 -0400 Subject: [PATCH] Mongoimport now fails on invalid UTF8 SERVER-1171 --- tools/import.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/import.cpp b/tools/import.cpp index de20fbb295e..0e12757d0be 100644 --- a/tools/import.cpp +++ b/tools/import.cpp @@ -21,6 +21,7 @@ #include "db/json.h" #include "tool.h" +#include "../util/text.h" #include #include @@ -53,6 +54,8 @@ class Import : public Tool { } BSONObj parseLine( char * line ){ + uassert(13289, "Invalid UTF8 character detected", isValidUTF8(line)); + if ( _type == JSON ){ char * end = ( line + strlen( line ) ) - 1; while ( isspace(*end) ){