Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions heiFIP/assets/heiFIPPacketImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ class heiFIPPacketImage {
}
}

// 3) If auto_dim is requested, compute dim = ceil(sqrt(length))
if (auto_dim) {
// 3) If auto_dim is requested or dim is invalid, compute dim = ceil(sqrt(length))
if (auto_dim || dim <= 0) {
dim = static_cast<int>(std::ceil(std::sqrt(static_cast<double>(length))));
}

Expand Down
5 changes: 5 additions & 0 deletions heiFIP/extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ class FIPExtractor {
size_t maxImageDim,
bool removeDuplicates)
{
if (image.get_matrix().empty() || image.get_matrix()[0].empty()) {
std::cout << "[!] Image not created: empty matrix.\n";
return false;
}

size_t height = image.get_matrix().size();
size_t width = image.get_matrix()[0].size();

Expand Down
2 changes: 1 addition & 1 deletion heiFIP/layers/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PacketProcessor {
std::unique_ptr<pcpp::RawPacket> rawPacketPt;
size_t count = 0;

while (count < maxCount && reader.getNextPacket(rawPacket)) {
while ((maxCount == 0 || count < maxCount) && reader.getNextPacket(rawPacket)) {
rawPacketPt = std::make_unique<pcpp::RawPacket>(rawPacket);
std::unique_ptr<FIPPacket> fippkt = preprocess(rawPacketPt, type);

Expand Down
Loading