diff options
author | Aapo Tahkola <aet@rasterburn.org> | 2005-02-19 02:25:53 +0000 |
---|---|---|
committer | Aapo Tahkola <aet@rasterburn.org> | 2005-02-19 02:25:53 +0000 |
commit | 42896b2a18a89c74a2f95e491bed0b7352bef0aa (patch) | |
tree | bb40fef885acfd0c9676ee10f8719bc23b3f6c08 /src/mesa/drivers/dri/r300/r300_cmdbuf.c | |
parent | 10b892af96afa4fd8493810f5cf84a97c2e4adaa (diff) |
Fix for buffer overrun caused by ALLOC_STATE not having args surrounded by parenthesis. Can you see it? HINT: Anything texture related should now work slightly better. And yes it took me several hours to find it.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_cmdbuf.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_cmdbuf.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c515b601b0..c9cd137f1c 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -183,7 +183,6 @@ static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty) } } - /** * Copy dirty hardware state atoms into the command buffer. * @@ -197,7 +196,7 @@ void r300EmitState(r300ContextPtr r300) if (r300->cmdbuf.count_used && !r300->hw.is_dirty && !r300->hw.all_dirty) return; - + /* To avoid going across the entire set of states multiple times, just check * for enough space for the case of emitting all state, and inline the * r300AllocCmdBuf code here without all the checks. @@ -270,13 +269,13 @@ CHECK( vpu, vpucount(atom->cmd) ? (1 + vpucount(atom->cmd)*4) : 0 ) #define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \ do { \ - r300->hw.ATOM.cmd_size = SZ; \ - r300->hw.ATOM.cmd = (uint32_t*)CALLOC(SZ * sizeof(uint32_t)); \ - r300->hw.ATOM.name = NM; \ - r300->hw.ATOM.idx = IDX; \ + r300->hw.ATOM.cmd_size = (SZ); \ + r300->hw.ATOM.cmd = (uint32_t*)CALLOC((SZ) * sizeof(uint32_t)); \ + r300->hw.ATOM.name = (NM); \ + r300->hw.ATOM.idx = (IDX); \ r300->hw.ATOM.check = check_##CHK; \ r300->hw.ATOM.dirty = GL_FALSE; \ - r300->hw.max_state_size += SZ; \ + r300->hw.max_state_size += (SZ); \ } while (0) @@ -287,7 +286,7 @@ CHECK( vpu, vpucount(atom->cmd) ? (1 + vpucount(atom->cmd)*4) : 0 ) void r300InitCmdBuf(r300ContextPtr r300) { int size, i, mtu; - + r300->hw.max_state_size = 0; mtu = r300->radeon.glCtx->Const.MaxTextureUnits; |