File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -302,12 +302,17 @@ def test_find_end(self):
302302 def test_find_does_not_access_beyond_buffer (self ):
303303 try :
304304 flags = mmap .MAP_PRIVATE | mmap .MAP_ANONYMOUS
305- except AttributeError :
306- raise unittest .SkipTest ("mmap flags unavailable" )
305+ PAGESIZE = mmap .PAGESIZE
306+ PROT_NONE = 0
307+ PROT_READ = mmap .PROT_READ
308+ except AttributeError as e :
309+ raise unittest .SkipTest ("mmap flags unavailable" ) from e
307310 for i in range (0 , 2049 ):
308- with mmap .mmap (0 , 4096 * (i + 1 ), flags = flags , prot = 0 ) as guard :
309- with mmap .mmap (0 , 8388608 + 4096 * i , flags = flags , prot = mmap .PROT_READ ) as fm :
310- fm .find (b"fo" )
311+ with mmap .mmap (- 1 , PAGESIZE * (i + 1 ),
312+ flags = flags , prot = PROT_NONE ) as guard :
313+ with mmap .mmap (- 1 , PAGESIZE * (i + 2048 ),
314+ flags = flags , prot = PROT_READ ) as fm :
315+ fm .find (b"fo" , - 2 )
311316
312317 def test_rfind (self ):
313318 # test the new 'end' parameter works as expected
You can’t perform that action at this time.
0 commit comments