mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Avoid reading past the end of the buffer in vkd3d_string_buffer_trace() (Valgrind).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
86cf5145dc
commit
dffff8bdbc
@ -93,15 +93,15 @@ static int VKD3D_PRINTF_FUNC(2, 3) vkd3d_string_buffer_printf(struct vkd3d_strin
|
|||||||
|
|
||||||
static void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
|
static void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
|
||||||
{
|
{
|
||||||
const char *p, *q;
|
const char *p, *q, *end = buffer->buffer + buffer->content_size;
|
||||||
|
|
||||||
if (!TRACE_ON())
|
if (!TRACE_ON())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (p = buffer->buffer; *p; p = q)
|
for (p = buffer->buffer; p < end; p = q)
|
||||||
{
|
{
|
||||||
if (!(q = strchr(p, '\n')))
|
if (!(q = memchr(p, '\n', end - p)))
|
||||||
q = p + strlen(p);
|
q = end;
|
||||||
else
|
else
|
||||||
++q;
|
++q;
|
||||||
vkd3d_dbg_printf(VKD3D_DBG_LEVEL_TRACE, function, "%.*s", (int)(q - p), p);
|
vkd3d_dbg_printf(VKD3D_DBG_LEVEL_TRACE, function, "%.*s", (int)(q - p), p);
|
||||||
|
Loading…
Reference in New Issue
Block a user