gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= 512 (GH-96890)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 19ca114645)

Co-authored-by: Koki Saito <49419225+saito828koki@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-10-02 18:11:17 -07:00 committed by GitHub
parent 72d445a22e
commit c2d3f73da7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -5377,6 +5377,14 @@ def test_resource_tracker_reused(self):
self.assertTrue(is_resource_tracker_reused)
def test_too_long_name_resource(self):
# gh-96819: Resource names that will make the length of a write to a pipe
# greater than PIPE_BUF are not allowed
rtype = "shared_memory"
too_long_name_resource = "a" * (512 - len(rtype))
with self.assertRaises(ValueError):
resource_tracker.register(too_long_name_resource, rtype)
class TestSimpleQueue(unittest.TestCase):