From baabce812704826c5f7b20ed4afcca816cab7967 Mon Sep 17 00:00:00 2001
From: Serhei Makarov <smakarov@redhat.com>
Date: Thu, 25 Oct 2018 12:19:53 -0400
Subject: [PATCH 10/32] bpf-translate.cxx :: plug an exception gap in
is_numeric()
---
bpf-translate.cxx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bpf-translate.cxx b/bpf-translate.cxx
index df22401ad..bf55c56b4 100644
--- a/bpf-translate.cxx
+++ b/bpf-translate.cxx
@@ -681,11 +681,15 @@ is_numeric (const std::string &str)
size_t pos = 0;
try {
stol(str, &pos, 0);
- } catch (std::invalid_argument &e) {
+ } catch (const std::invalid_argument &e) {
return false;
- } catch (std::out_of_range &e) {
+ } catch (const std::out_of_range &e) {
/* XXX: probably numeric but not valid; give up */
return false;
+ } catch (...) {
+ /* XXX: handle other errors the same way */
+ std::cerr << "BUG: bpf assembler -- is_numeric() saw unexpected exception" << std::endl;
+ return false;
}
return (pos == str.size());
}
--
2.14.5