Merge pull request #284 from DrChat/append_ptr_fix

Fix AppendParam dereferencing NULL pointers
This commit is contained in:
Ben Vanik 2015-06-25 17:41:06 -07:00
commit 9dd40e18b4
1 changed files with 16 additions and 6 deletions

View File

@ -329,18 +329,28 @@ inline void AppendParam(StringBuffer& string_buffer, lpvoid_t param) {
string_buffer.AppendFormat("%.8X", uint32_t(param)); string_buffer.AppendFormat("%.8X", uint32_t(param));
} }
inline void AppendParam(StringBuffer& string_buffer, lpdword_t param) { inline void AppendParam(StringBuffer& string_buffer, lpdword_t param) {
string_buffer.AppendFormat("%.8X(%.8X)", param.guest_address(), string_buffer.AppendFormat("%.8X", param.guest_address());
param.value()); if (param) {
string_buffer.AppendFormat("(%.8X)", param.value());
}
} }
inline void AppendParam(StringBuffer& string_buffer, lpqword_t param) { inline void AppendParam(StringBuffer& string_buffer, lpqword_t param) {
string_buffer.AppendFormat("%.8X(%.16llX)", param.guest_address(), string_buffer.AppendFormat("%.8X", param.guest_address());
param.value()); if (param) {
string_buffer.AppendFormat("(%.16llX)", param.value());
}
} }
inline void AppendParam(StringBuffer& string_buffer, lpfloat_t param) { inline void AppendParam(StringBuffer& string_buffer, lpfloat_t param) {
string_buffer.AppendFormat("%.8X(%G)", param.guest_address(), param.value()); string_buffer.AppendFormat("%.8X", param.guest_address());
if (param) {
string_buffer.AppendFormat("(%G)", param.value());
}
} }
inline void AppendParam(StringBuffer& string_buffer, lpdouble_t param) { inline void AppendParam(StringBuffer& string_buffer, lpdouble_t param) {
string_buffer.AppendFormat("%.8X(%G)", param.guest_address(), param.value()); string_buffer.AppendFormat("%.8X", param.guest_address());
if (param) {
string_buffer.AppendFormat("(%G)", param.value());
}
} }
template <typename T> template <typename T>
void AppendParam(StringBuffer& string_buffer, pointer_t<T> param) { void AppendParam(StringBuffer& string_buffer, pointer_t<T> param) {