Skip to content

Commit 2964a98

Browse files
authored
[fix] verify image when preload (#971)
1 parent 1efada3 commit 2964a98

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightllm/server/multimodal_params.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ async def preload(self, request: Request):
9898
else:
9999
raise ValueError(f"cannot read image which type is {self._type}!")
100100

101-
# check if valid image bytes
102-
image = Image.open(BytesIO(img_data))
103-
self.image_w, self.image_h = image.size
101+
with Image.open(BytesIO(img_data)) as image:
102+
self.image_w, self.image_h = image.size
103+
image.verify() # verify后会失效
104+
104105
self._preload_data = img_data
105106
return
106107

0 commit comments

Comments
 (0)