Created attachment 12764
reproduce JSON dessector error
Build Information:
Version 1.10.7 (v1.10.7-0-g6b931a15 from master-1.10)
Compiled (32-bit) with GTK+ 2.24.14, with Cairo 1.10.2, with Pango 1.30.1, with
GLib 2.34.1, with WinPcap (4_1_3), with libz 1.2.5, without POSIX capabilities,
without libnl, with SMI 0.4.8, with c-ares 1.9.1, with Lua 5.1, without Python,
with GnuTLS 2.12.18, with Gcrypt 1.4.6, with MIT Kerberos, with GeoIP, with
PortAudio V19-devel (built Apr 22 2014), with AirPcap.
Running on 32-bit Windows 7 Service Pack 1, build 7601, with WinPcap version
4.1.3 (packet.dll version 4.1.0.2980), based on libpcap version 1.0 branch
1_0_rel0b (20091008), GnuTLS 2.12.18, Gcrypt 1.4.6, without AirPcap.
Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz, with 3070MB of physical memory.
Built using Microsoft Visual C++ 10.0 build 40219
choose "3 МБайт" and press the buttonWarn Dissector bug, protocol JSON, in packet 10551: emem.c:784: failed assertion "size<((10 * 1024 * 1024)>>2)"
This is very similar to bug #10081 (closed) in that the Content-Length field in HTTP is greater than the maximum size that emem allowed. But this is occuring during actual dissection (where emem is supposed to be used), not just outputing fields.
Is it fair to question whether tvbparse functionality should use emem? It appears that where this issues lies, but again Content-Length is really to blame.
Also of note, in 1.10.7 in Windows I get the "Dissector bug" noted here, but it crashes Wireshark completely on the trunk.
(In reply to comment #2) > Is it fair to question whether tvbparse functionality should use emem? It > appears that where this issues lies, but again Content-Length is really to > blame. It's not a problem with tvbparse using emem, it's JSON dissector trying to allocate this memory:275 static char *json_string_unescape(tvbparse_elem_t *tok)277 char *str = (char *)wmem_alloc(wmem_packet_scope(), tok->len - 1);// where tok->len == 3145718 (3.1 MB)Not sure what can be done - I was thinking about just returning not unescaped string, but in such way, filtering might not work (like you need to search for string "xxx", but malware escape it to \u0078\u0078\u0078) - just a sample.Anyway, allocator should not do abort().
I guess we shouldn't have removed jumbo support from fast block allocator after all, sorry :PAllocating 3 MB is not terribly unreasonable for a dissector in weird conditions; it seems like a validly calculated length (after a *lot* of reassembly) so we should only fail on it if the OS can't give us any more memory.https://code.wireshark.org/review/1688