File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,29 @@ def test_file_parsing_timeout(self):
227227 )
228228 self .assertEqual (result .stderr , None )
229229
230+ def test_file_parsing_depth_limit (self ):
231+ code = dedent (
232+ """
233+ import os
234+
235+ x = ""
236+ for _ in range(1000):
237+ x += "a/"
238+ os.mkdir(x)
239+
240+ open(f"{x}test.txt", "w").write("test")
241+ """
242+ ).strip ()
243+
244+ nsjail = NsJail (memfs_instance_size = 32 * Size .MiB , files_timeout = 5 )
245+ result = nsjail .python3 (["-c" , code ])
246+ self .assertEqual (result .returncode , None )
247+ self .assertEqual (
248+ result .stdout ,
249+ "FileParsingError: Exceeded directory depth limit while parsing attachments" ,
250+ )
251+ self .assertEqual (result .stderr , None )
252+
230253 def test_file_write_error (self ):
231254 """Test errors during file write."""
232255 result = self .nsjail .python3 (
You can’t perform that action at this time.
0 commit comments