| Summary: | X11 SDL_CreateYUVOverlay() fails on large image resolutions | ||
|---|---|---|---|
| Product: | SDL | Reporter: | pross |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | netbeans |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
pross
2009-01-31 15:54:36 UTC
The 1.2 SVN segfault is caused by XvShmCreateImage() not allocating memory for XvImage->pitches array, thefore hwdata->image->pitches is NULL.
From XvShmCreateImage:
===
hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format,
0, width, height, yuvshm);
#ifdef PITCH_WORKAROUND
if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
^^^^^^^^^^
/* Ajust overlay width according to pitch */
XFree(hwdata->image);
width = hwdata->image->pitches[0] / bpp;
^^^^^^^^^^
===
I am using FFPLAY from ffmpeg to play a 1920x1080 avchd video. The laptop has only a 1024x768 video screen with 8mb video.
After a long discourse( ffmpef bug report 2079 ) , the cause of the malloc buffer overrun is from the (allegged) bad information returned from a call to SDL_CreateYUVOverlay.
vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
SDL_YV12_OVERLAY,
screen);
According to ffplay folks, the SDL_CreateYUVOverlay results are wrong
(gdb) p vp->width
$4 = 1920
(gdb) p vp->height
$5 = 1080
(gdb) p *screen
$6 = {flags = 16, format = 0x8c352a8, w = 1920, h = 1080, pitch = 7680, pixels = 0xae016000, offset = 0, hwdata = 0x0,
clip_rect = {x = 0, y = 0, w = 1920, h = 1080}, unused1 = 0, locked = 0, map = 0x8c3e6e8, format_version = 2,
refcount = 1}
(gdb) p *vp->bmp
$7 = {format = 842094169, w = 1920, h = 1080, planes = 3, pitches = 0x8c55700, pixels = 0x8c55bf8, hwfuncs = 0x86b4a40,
hwdata = 0x8c3e6a8, hw_overlay = 1, UnusedBits = 0}
(gdb) p vp->bmp->pitches[0]
$8 = 1024
(gdb) p vp->bmp->pitches[1]
$9 = 512
(gdb) p vp->bmp->pitches[2]
$10 = 512
(gdb)
It is not clear to me what wrong. But ffplay uses the 1920h to copy the buffer, and overruns the 1024 allocated.
Is this the same issue, or is it another bug?
I just tested this with the latest SDL 1.3 snapshot. The test program exits immediately because the window height is smaller than the image height and it's trying to slide the image to the bottom of the window. It works fine if you specify a width and height of 4096. Thanks! |