mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
patterns: Disallow application/octet-stream to be used as MIME type
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/magic.hpp>
|
||||
|
||||
#include <pl/core/evaluator.hpp>
|
||||
|
||||
@@ -8,8 +9,6 @@ namespace hex::plugin::builtin {
|
||||
void registerPatternLanguagePragmas() {
|
||||
|
||||
ContentRegistry::PatternLanguage::addPragma("base_address", [](pl::PatternLanguage &runtime, const std::string &value) {
|
||||
hex::unused(runtime);
|
||||
|
||||
auto baseAddress = strtoull(value.c_str(), nullptr, 0);
|
||||
|
||||
ImHexApi::Provider::get()->setBaseAddress(baseAddress);
|
||||
@@ -18,7 +17,9 @@ namespace hex::plugin::builtin {
|
||||
return true;
|
||||
});
|
||||
|
||||
ContentRegistry::PatternLanguage::addPragma("MIME", [](pl::PatternLanguage&, const std::string &value) { return !value.empty(); });
|
||||
ContentRegistry::PatternLanguage::addPragma("MIME", [](pl::PatternLanguage&, const std::string &value) {
|
||||
return magic::isValidMIMEType(value);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user