File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed
Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,7 @@ def __next__(self):
186186 print ("Unknown event type:" + chunk )
187187 continue
188188
189+
189190 # Check buffer size before writing to prevent unbounded memory consumption
190191 chunk_size = len (chunk ["PayloadPart" ]["Bytes" ])
191192 current_size = self .buffer .getbuffer ().nbytes
@@ -195,5 +196,6 @@ def __next__(self):
195196 f"No newline found in stream."
196197 )
197198
199+
198200 self .buffer .seek (0 , io .SEEK_END )
199201 self .buffer .write (chunk ["PayloadPart" ]["Bytes" ])
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ def __init__(self, root_path):
138138
139139 self .root_path = os .path .abspath (root_path )
140140
141+
141142 # Validate that the path is not in restricted locations
142143 for restricted_path in self .RESTRICTED_PATHS :
143144 if self .root_path .startswith (restricted_path ):
@@ -146,6 +147,7 @@ def __init__(self, root_path):
146147 f"Got: { root_path } "
147148 )
148149
150+
149151 if not os .path .exists (self .root_path ):
150152 raise RuntimeError ("Invalid data source: %s does not exist." % self .root_path )
151153
You can’t perform that action at this time.
0 commit comments