From 0c8207cedd5b62c05e33661e8b32e045ba1bbbac Mon Sep 17 00:00:00 2001
From: Jake Shadle
Date: Mon, 26 Feb 2024 09:04:58 +0100
Subject: [PATCH] Fix panic if there were additional `.`
---
src/linux/maps_reader.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/linux/maps_reader.rs b/src/linux/maps_reader.rs
index bf54e419..bfc32123 100644
--- a/src/linux/maps_reader.rs
+++ b/src/linux/maps_reader.rs
@@ -450,6 +450,8 @@ impl SoVersion {
for (i, comp) in version.split('.').enumerate() {
if i <= 1 {
*comps[i] = comp.parse().unwrap_or_default();
+ } else if i >= 4 {
+ break;
} else {
// In some cases the release/patch version is alphanumeric (eg. '2rc5'),
// so try to parse either a single or two numbers
@@ -752,6 +754,8 @@ a4840000-a4873000 rw-p 09021000 08:12 393449 /data/app/org.mozilla.firefox-1
("/usr/lib/x86_64-linux-gnu/libdbus-1.so.3.34.rc5", (3, 34, 0, 5)),
("/usr/lib/x86_64-linux-gnu/libtoto.so.AAA", (0, 0, 0, 0)),
("/usr/lib/x86_64-linux-gnu/libsemver-1.so.1.2.alpha.1", (1, 2, 0, 1)),
+ ("/usr/lib/x86_64-linux-gnu/libboop.so.1.2.3.4.5", (1, 2, 3, 4)),
+ ("/usr/lib/x86_64-linux-gnu/libboop.so.1.2.3pre4.5", (1, 2, 3, 4)),
];
assert!(SoVersion::parse(OsStr::new("/home/alex/bin/firefox/libmozsandbox.so")).is_none());