bug in gdbproxy.c?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
asmblur
Newbie
Newbie
Posts: 1
Joined: Sun Apr 23, 2017 9:44 am

bug in gdbproxy.c?

Post by asmblur »

I believe this is a bug but maybe I'm missing something(it's waay past my bedtime):

line 2330 checks if "len"(the number of bytes actually read into the buffer) is less than "gdbctx->in_buf_alloc - gdbctx->in_len"(the number of bytes of "free" space in the buffer). However, this is done *after* increasing "gdbctx->in_len"(the number of bytes "used"/"available" in the buffer) by "len" at line 2328:
programs/winedbg/gdbproxy.c
2326 len = read(gdbctx->sock, gdbctx->in_buf + gdbctx->in_len, gdbctx->in_buf_alloc - gdbctx->in_len);
2327 if (len <= 0) break;
2328 gdbctx->in_len += len;
2329 assert(gdbctx->in_len <= gdbctx->in_buf_alloc);
2330 if (len < gdbctx->in_buf_alloc - gdbctx->in_len) break;

// patch(break out of the loop if the buffer has any free space left, meaning the number of bytes actually read was less than the number of bytes we tried to read(i.e. the number of bytes that were free at the time)):
2330 if (gdbctx->in_buf_alloc - gdbctx->in_len > 0) break;
Locked