Skip to content

Commit bbfbf1f

Browse files
author
dianjixz
committed
Merge branch 'main' of github.com:m5stack/StackFlow
2 parents 4a2394c + 466b770 commit bbfbf1f

File tree

1 file changed

+6
-0
lines changed
  • projects/llm_framework/main_vlm/src

1 file changed

+6
-0
lines changed

projects/llm_framework/main_vlm/src/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ class llm_task {
198198
std::string out = lLaMa_->Run(prompt_data_);
199199
if (out_callback_) out_callback_(out, true);
200200
} else {
201+
if (image_data_.size() > 2 && image_data_[0] == 0xFF && image_data_[1] == 0xD8 &&
202+
image_data_[image_data_.size() - 2] == 0xFF && image_data_[image_data_.size() - 1] == 0xD9) {
203+
} else {
204+
SLOGE("Invalid JPEG data.");
205+
return;
206+
}
201207
cv::Mat src = cv::imdecode(image_data_, cv::IMREAD_COLOR);
202208
image_data_.clear();
203209
lLaMa_->Encode(src, img_embed);

0 commit comments

Comments
 (0)