Skip to content

Commit 0d68764

Browse files
peffgitster
authored andcommitted
fsck: split ".gitmodules too large" error from parse failure
Since ed8b10f (fsck: check .gitmodules content, 2018-05-02), we'll report a gitmodulesParse error for two conditions: - a .gitmodules entry is not syntactically valid - a .gitmodules entry is larger than core.bigFileThreshold with the intent that we can detect malicious files and protect downstream clients. E.g., from the issue in 0383bbb (submodule-config: verify submodule names as paths, 2018-04-30). But these conditions are actually quite different with respect to that bug: - a syntactically invalid file cannot trigger the problem, as the victim would barf before hitting the problematic code - a too-big .gitmodules _can_ trigger the problem. Even though it is obviously silly to have a 500MB .gitmodules file, the submodule code will happily parse it if you have enough memory. So it may be reasonable to configure their severity separately. Let's add a new class for the "too large" case to allow that. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent de6bd9e commit 0d68764

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fsck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static struct oidset gitmodules_done = OIDSET_INIT;
6363
FUNC(GITMODULES_MISSING, ERROR) \
6464
FUNC(GITMODULES_BLOB, ERROR) \
6565
FUNC(GITMODULES_PARSE, ERROR) \
66+
FUNC(GITMODULES_LARGE, ERROR) \
6667
FUNC(GITMODULES_NAME, ERROR) \
6768
FUNC(GITMODULES_SYMLINK, ERROR) \
6869
/* warnings */ \
@@ -1005,7 +1006,7 @@ static int fsck_blob(struct blob *blob, const char *buf,
10051006
* that an error.
10061007
*/
10071008
return report(options, &blob->object,
1008-
FSCK_MSG_GITMODULES_PARSE,
1009+
FSCK_MSG_GITMODULES_LARGE,
10091010
".gitmodules too large to parse");
10101011
}
10111012

0 commit comments

Comments
 (0)