From 5ba1f867a1f838e9b88b4247e8fc4839a929aaa2 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 16 Jun 2011 17:47:52 +0200 Subject: [PATCH] d3dxof: Check returns of read_bytes (Coverity). --- dlls/d3dxof/parsing.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c index cbf1761e8c1..4acaaba0028 100644 --- a/dlls/d3dxof/parsing.c +++ b/dlls/d3dxof/parsing.c @@ -233,8 +233,10 @@ HRESULT parse_header(parse_buffer * buf, BYTE ** decomp_buffer_ptr) buf->rem_bytes -= sizeof(WORD) * 2; buf->buffer += sizeof(WORD) * 2; - read_bytes(buf, &decomp_size, sizeof(decomp_size)); - read_bytes(buf, &comp_size, sizeof(comp_size)); + if (!read_bytes(buf, &decomp_size, sizeof(decomp_size))) + return DXFILEERR_BADFILETYPE; + if (!read_bytes(buf, &comp_size, sizeof(comp_size))) + return DXFILEERR_BADFILETYPE; TRACE("Compressed format %s detected: compressed_size = %x, decompressed_size = %x\n", debugstr_fourcc(header[2]), comp_size, decomp_size); @@ -1049,7 +1051,8 @@ static void go_to_next_definition(parse_buffer * buf) char c; while (buf->rem_bytes) { - read_bytes(buf, &c, 1); + if (!read_bytes(buf, &c, 1)) + return; if ((c == '#') || (c == '/')) { /* Handle comment (# or //) */