Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-24 Thread liujunjie (A)
devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow > > "liujunjie (A)" writes: > > > Even using gdb command: set print elements 0, is still too large to print > > the > whole string. > > So I try to obtain the string

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-24 Thread Markus Armbruster
"liujunjie (A)" writes: > Even using gdb command: set print elements 0, is still too large to print the > whole string. > So I try to obtain the string in another way. > After several attempts(not easy in fact), I finally obtain the real length. > The way is as follows: > (gdb) p (int *)str > $

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-24 Thread liujunjie (A)
rmbruster > Cc: liujunjie (A) ; wangxin (U) > ; Gonglei (Arei) ; > Huangweidong (C) ; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow > > Markus Armbruster writes: > > > "liujunjie (A)" writes: > > > &

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-24 Thread Markus Armbruster
Markus Armbruster writes: > "liujunjie (A)" writes: > >> The stack backtrace is as follows: >> (gdb) bt >> #0 0x7f1dc3c7b091 in _g_log_abort () from /usr/lib64/libglib-2.0.so.0 >> #1 0x7f1dc3c7c0bd in g_log_default_handler () from >> /usr/lib64/libglib-2.0.so.0 >> #2 0x7f1dc3c7c3

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread Markus Armbruster
"liujunjie (A)" writes: > The stack backtrace is as follows: > (gdb) bt > #0 0x7f1dc3c7b091 in _g_log_abort () from /usr/lib64/libglib-2.0.so.0 > #1 0x7f1dc3c7c0bd in g_log_default_handler () from > /usr/lib64/libglib-2.0.so.0 > #2 0x7f1dc3c7c341 in g_logv () from /usr/lib64/libgl

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread liujunjie (A)
gt; ; Huangweidong (C) > ; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow > > On 07/20/2018 08:09 AM, liujunjie wrote: > > From: l00425170 > > > > The incoming parameters "start" and "end" is int t

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread liujunjie (A)
- > From: Markus Armbruster [mailto:arm...@redhat.com] > Sent: Monday, July 23, 2018 11:46 PM > To: liujunjie (A) > Cc: wangxin (U) ; Gonglei (Arei) > ; Huangweidong (C) > ; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow > > "liu

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread Markus Armbruster
"liujunjie (A)" writes: > Thanks for your reply. >> Really? How exactly can this happen? Please explain step by step. > There exist a qemu core related to this. You have mention that "The > conversion truncates when strlen(str) - 1 exceeds INT_MAX". > Later in function qstring_from_substr, thi

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread Eric Blake
On 07/20/2018 08:09 AM, liujunjie wrote: From: l00425170 The incoming parameters "start" and "end" is int type in qstring_from_substr(), but this function can be called by qstring_from_str, which is size_t type in strlen(str). It may result in coredump when called g_malloc later. One scene to t

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread liujunjie (A)
(A) > Cc: wangxin (U) ; Gonglei (Arei) > ; Huangweidong (C) > ; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow > > liujunjie writes: > > > From: l00425170 > > > > The incoming parameters "start" and &

Re: [Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-23 Thread Markus Armbruster
liujunjie writes: > From: l00425170 > > The incoming parameters "start" and "end" is int type in > qstring_from_substr(), but this function can be called by > qstring_from_str, which is size_t type in strlen(str). Yes, there's a conversion from size_t to int in return qstring_from_substr(s

[Qemu-devel] [PATCH] qstring: Fix integer overflow

2018-07-20 Thread liujunjie
From: l00425170 The incoming parameters "start" and "end" is int type in qstring_from_substr(), but this function can be called by qstring_from_str, which is size_t type in strlen(str). It may result in coredump when called g_malloc later. One scene to triger is to call hmp "into tlb", which may