summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-05-03 13:20:24 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-05-04 18:47:53 +0300
commit6388449a790a610718a86aed585da1096f707159 (patch)
treef70e8e25dc7566d3c09b40c5d12e12edec6c93a0
parent312e9910ba2ee8099676db7f5c5f2a17bd87f0c6 (diff)
libcamera: ipa: Remove character restriction on the IPA name
Remove the restriction on using the '/' character in the IPA name string. This allows more flexibility in IPA directory structures where different IPA modules might live in subdirectories under the usual src/ipa/<platform>/ top level directory. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/ipa_module.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index c152153c..f2dd87e5 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -225,9 +225,9 @@ Span<const uint8_t> elfLoadSymbol(Span<const uint8_t> elf, const char *symbol)
* \brief The name of the IPA module
*
* The name may be used to build file system paths to IPA-specific resources.
- * It shall only contain printable characters, and may not contain '/', '*',
- * '?' or '\'. For IPA modules included in libcamera, it shall match the
- * directory of the IPA module in the source tree.
+ * It shall only contain printable characters, and may not contain '*', '?' or
+ * '\'. For IPA modules included in libcamera, it shall match the directory of
+ * the IPA module in the source tree.
*
* \todo Allow user to choose to isolate open source IPAs
*/
@@ -300,13 +300,18 @@ int IPAModule::loadIPAModuleInfo()
return -EINVAL;
}
- /* Validate the IPA module name. */
+ /*
+ * Validate the IPA module name.
+ *
+ * \todo Consider module naming restrictions to avoid escaping from a
+ * base directory. Forbidding ".." may be enough, but this may be best
+ * implemented in a different layer.
+ */
std::string ipaName = info_.name;
auto iter = std::find_if_not(ipaName.begin(), ipaName.end(),
[](unsigned char c) -> bool {
- return isprint(c) && c != '/' &&
- c != '?' && c != '*' &&
- c != '\\';
+ return isprint(c) && c != '?' &&
+ c != '*' && c != '\\';
});
if (iter != ipaName.end()) {
LOG(IPAModule, Error)