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

Unified Diff: net/ftp/ftp_directory_listing_parser_ls_unittest.cc

Issue 4182002: FTP: fix directory listing parser for ftp://ftp.dd-wrt.com/others/juno6/ (Closed)
Patch Set: typo Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: net/ftp/ftp_directory_listing_parser_ls_unittest.cc
diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
index 4b3654456a675e0b524bf184051e7ed478e72b20..3e777ccbef60decf5b6859f1b6139025ddda0bf9 100644
--- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
@@ -91,6 +91,28 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) {
}
}
+TEST_F(FtpDirectoryListingParserLsTest, Ignored) {
+ const char* ignored_cases[] = {
+ "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065
+
+ // Tests important for security: verify that after we detect the column
+ // offset we don't try to access invalid memory on malformed input.
+ "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11",
+ "drwxr-xr-x 3 ftp 4096 May 15 18:11",
+ "drwxr-xr-x folder 0 May 15 18:11",
+ };
+ for (size_t i = 0; i < arraysize(ignored_cases); i++) {
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ ignored_cases[i]));
+
+ net::FtpDirectoryListingParserLs parser(GetMockCurrentTime());
+ EXPECT_TRUE(parser.ConsumeLine(UTF8ToUTF16(ignored_cases[i])));
wtc 2010/10/28 01:05:41 In the original code, we EXPECT_FALSE here (see li
Paweł Hajdan Jr. 2010/10/28 07:15:34 When ConsumeLine returns false, it means that the
+ EXPECT_FALSE(parser.EntryAvailable());
+ EXPECT_TRUE(parser.OnEndOfInput());
+ EXPECT_FALSE(parser.EntryAvailable());
+ }
+}
+
TEST_F(FtpDirectoryListingParserLsTest, Bad) {
const char* bad_cases[] = {
" foo",
@@ -112,12 +134,6 @@ TEST_F(FtpDirectoryListingParserLsTest, Bad) {
"d-wx-wx-wt++ 4 ftp 989 512 Dec 8 15:54 incoming",
"d-wx-wx-wt$ 4 ftp 989 512 Dec 8 15:54 incoming",
"-qqqqqqqqq+ 2 sys 512 Mar 27 2009 pub",
-
- // Tests important for security: verify that after we detect the column
- // offset we don't try to access invalid memory on malformed input.
- "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11",
- "drwxr-xr-x 3 ftp 4096 May 15 18:11",
- "drwxr-xr-x folder 0 May 15 18:11",
};
for (size_t i = 0; i < arraysize(bad_cases); i++) {
net::FtpDirectoryListingParserLs parser(GetMockCurrentTime());
« net/ftp/ftp_directory_listing_parser_ls.cc ('K') | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698