瀏覽代碼

Add mitigations against borked ARM32 exception unrollers, possibly fix GitHub issue #1003

Adam Ierymenko 5 年之前
父節點
當前提交
a16377cea5
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      service/OneService.cpp

+ 8 - 2
service/OneService.cpp

@@ -1353,8 +1353,8 @@ public:
 							if (j.is_object()) {
 							if (j.is_object()) {
 								seed = Utils::hexStrToU64(OSUtils::jsonString(j["seed"],"0").c_str());
 								seed = Utils::hexStrToU64(OSUtils::jsonString(j["seed"],"0").c_str());
 							}
 							}
+						} catch (std::exception &exc) {
 						} catch ( ... ) {
 						} catch ( ... ) {
-							// discard invalid JSON
 						}
 						}
 
 
 						std::vector<World> moons(_node->moons());
 						std::vector<World> moons(_node->moons());
@@ -1403,8 +1403,8 @@ public:
 											json &allowDefault = j["allowDefault"];
 											json &allowDefault = j["allowDefault"];
 											if (allowDefault.is_boolean()) localSettings.allowDefault = (bool)allowDefault;
 											if (allowDefault.is_boolean()) localSettings.allowDefault = (bool)allowDefault;
 										}
 										}
+									} catch (std::exception &exc) {
 									} catch ( ... ) {
 									} catch ( ... ) {
-										// discard invalid JSON
 									}
 									}
 
 
 									setNetworkSettings(nws->networks[i].nwid,localSettings);
 									setNetworkSettings(nws->networks[i].nwid,localSettings);
@@ -2035,6 +2035,8 @@ public:
 					return;
 					return;
 
 
 			}
 			}
+		} catch (std::exception &exc) {
+			_phy.close(sock);
 		} catch ( ... ) {
 		} catch ( ... ) {
 			_phy.close(sock);
 			_phy.close(sock);
 		}
 		}
@@ -2143,6 +2145,10 @@ public:
 #endif
 #endif
 						_nets.erase(nwid);
 						_nets.erase(nwid);
 						return -999;
 						return -999;
+					} catch (std::exception &exc) {
+						return -999;
+					} catch (int exc) {
+						return -999;
 					} catch ( ... ) {
 					} catch ( ... ) {
 						return -999; // tap init failed
 						return -999; // tap init failed
 					}
 					}