Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115652
D1093.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D1093.diff
View Options
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -930,6 +930,12 @@
// Disabled opcode.
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE);
}
+ // 2nd operand must not be 0
+ if (bn2 == 0) {
+ return set_error(serror,
+ SCRIPT_ERR_DIV_BY_ZERO);
+ }
+ bn = bn1 / bn2;
break;
case OP_MOD:
diff --git a/src/script/script.h b/src/script/script.h
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -275,6 +275,12 @@
inline CScriptNum operator-(const CScriptNum &rhs) const {
return operator-(rhs.m_value);
}
+ inline CScriptNum operator/(const int64_t &rhs) const {
+ return CScriptNum(m_value / rhs);
+ }
+ inline CScriptNum operator/(const CScriptNum &rhs) const {
+ return operator/(rhs.m_value);
+ }
inline CScriptNum &operator+=(const CScriptNum &rhs) {
return operator+=(rhs.m_value);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:39 (2 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187655
Default Alt Text
D1093.diff (1 KB)
Attached To
D1093: Adds OP_DIV functionality into interpreter.cpp
Event Timeline
Log In to Comment