[Openchrome-devel] XvMC allocation fixes
Daniel Drake
dan
Thu Nov 27 12:02:57 PST 2008
Users at https://bugs.gentoo.org/show_bug.cgi?id=228473 report problems using
software such as MythTV:
ViaXvMC: Could not allocate timestamp blit area.
2008-06-20 11:25:39.231 VideoOutputXv Error: Unable to create XvMC Context, status(11): BadAlloc
2008-06-20 11:25:39.233 VideoOutputXv Error: Could not open XvMC port...
We tracked this down to a bug in the libxvmc code, which does not
pass the right structure size to the ioctl: it calls sizeof() on a pointer
I also audited all the other ioctls and did not find any other occurences
of this error.
Index: xf86-video-openchrome-0.2.903/libxvmc/viaLowLevelPro.c
===================================================================
--- xf86-video-openchrome-0.2.903.orig/libxvmc/viaLowLevelPro.c
+++ xf86-video-openchrome-0.2.903/libxvmc/viaLowLevelPro.c
@@ -1460,13 +1460,13 @@ updateLowLevelBuf(XvMCLowLevel * xl, Low
if (size != mem->size) {
if (mem->size)
- drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(mem));
+ drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(*mem));
mem->context = *(xl->drmcontext);
mem->size = size;
mem->type = VIA_MEM_VIDEO;
if (((ret = drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, mem,
- sizeof(mem))) < 0) || mem->size != size) {
+ sizeof(*mem))) < 0) || mem->size != size) {
mem->size = 0;
return -1;
}
@@ -1484,7 +1484,7 @@ cleanupLowLevelBuf(XvMCLowLevel * xl, Lo
drm_via_mem_t *mem = &buf->mem;
if (mem->size)
- drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(mem));
+ drmCommandWrite(xl->fd, DRM_VIA_FREEMEM, mem, sizeof(*mem));
mem->size = 0;
}
More information about the Openchrome-devel
mailing list