diff options
author | Siri Hansen <[email protected]> | 2017-10-17 19:23:58 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-10-24 14:38:39 +0200 |
commit | 24c79977c7974d5415b6d4f7085a651ce1048e6a (patch) | |
tree | 70a8f069dab6750af446cc1bab071047c060f4b1 /lib/observer/src/observer_html_lib.erl | |
parent | 541ee20b9eaefed7802f08cecddfbd12e5f3b516 (diff) | |
download | otp-24c79977c7974d5415b6d4f7085a651ce1048e6a.tar.gz otp-24c79977c7974d5415b6d4f7085a651ce1048e6a.tar.bz2 otp-24c79977c7974d5415b6d4f7085a651ce1048e6a.zip |
[observer] Don't crash on empty binary
Commit e1310b8f introduced a bug which caused the observer tool (and
crashdump_viewer) to crash when trying to display an empty binary. The
same change would also cause leading zeros in a binary to disappear in
the preview. The bug is now corrected.
Diffstat (limited to 'lib/observer/src/observer_html_lib.erl')
-rw-r--r-- | lib/observer/src/observer_html_lib.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/observer/src/observer_html_lib.erl b/lib/observer/src/observer_html_lib.erl index a85808a472..22b4714d63 100644 --- a/lib/observer/src/observer_html_lib.erl +++ b/lib/observer/src/observer_html_lib.erl @@ -355,11 +355,11 @@ href_proc_bin(From, T, Acc, LTB) -> PreviewStr end end; - [PreviewIntStr,SizeStr,Md5] when From =:= obs -> + [PreviewIntStr,PreviewBitSizeStr,SizeStr,Md5] when From =:= obs -> Size = list_to_integer(SizeStr), PreviewInt = list_to_integer(PreviewIntStr), - PrevSize = (trunc(math:log2(PreviewInt)/8)+1)*8, - PreviewStr = preview_string(Size,<<PreviewInt:PrevSize>>), + PreviewBitSize = list_to_integer(PreviewBitSizeStr), + PreviewStr = preview_string(Size,<<PreviewInt:PreviewBitSize>>), if LTB -> href("TARGET=\"expanded\"", ["#OBSBinary?key1="++PreviewIntStr++ |