POV-Ray : Newsgroups : povray.beta-test : problem with +D option at specific output file dimensions : Re: problem with +D option at specific output file dimensions Server Time
17 May 2024 04:06:15 EDT (-0400)
  Re: problem with +D option at specific output file dimensions  
From: Le Forgeron
Date: 14 Dec 2013 15:16:41
Message: <52acbca9$1@news.povray.org>
I got it (but no correction yet)

The issue is in disp_sdl.cpp, UnixSDLDisplay::SetPixelScaled

		unsigned int ix = x * m_display_scale;
		unsigned int iy = y * m_display_scale;
is returning values which combined with

		Uint8 *p = (Uint8 *) m_display->pixels + iy * m_display->pitch + ix *
m_display->format->BytesPerPixel;

get p out of the m_display->pixels array. (and ofs out of PxCount array too)
(BytesPerPixel in my case is 4)

m_display_scale is a float, but m_display->pitch is an integer.

I guess that the current m_display_scale is a round-up representation of
the number m_display_scale = float(width) / GetWidth();
(line 245)

Round-up, because the representation of the exact value is not possible.
And btw, the code does not seems to handle a huge height when width is
small enough)

So, a small exaggeration on the ratio generates a memory corruption when
the display is on and scaled.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.