Commit Graph

11 Commits

Author SHA1 Message Date
Ell 12dde445c4 app: add gimp_temp_buf_{lock,unlock}()
In GimpTempBuf, add gimp_temp_buf_lock() and gimp_temp_buf_unlock()
functions, which lock/unlock the buffer for data access.  Unlike
gimp_temp_buf_get_data(), which returns a direct pointer to the
buffer's data, the new functions take a format parameter and may
return a temporary buffer, allowing the buffer to be accessed using
an arbitrary format.
2019-02-06 14:30:47 -05:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Tobias Stoeckmann f98d1b3a76 Bug 789613 - core: Fix integer overflow on 64 bit systems
The C language only promotes data values up to (un)signed int,
which is 32 bit, if no larger data type is used within the
calculation. Having a multiplication of two gint variables,
even if the expected target variable is of type gsize (64 bit),
leads to a possible integer overflow.

This bug can be triggered in gimp_temp_buf_new, which is used
to allocate memory for given supplied dimensions and bytes per
pixel. If triggered, less memory than needed is allocated and
therefore allows out of boundary accesses, either resulting in
possible code execution or information leakage.

While at it, make sure that the supplied format can actually be
resolved to a bytes per pixel value. If not, return NULL.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2018-01-01 17:10:01 +01:00
Michael Natterer a7cd595241 app: fix crashing typo in previous commit 2014-02-23 01:28:34 +01:00
Massimo Valentini 9498cc615d Bug 722676: Pasting image from clipboard sometimes does not work.
Change gimp_pixbuf_create_buffer() to copy the pixels if a linear
buffer cannot be created. Add functions that convert between
GimpTempBuf and GdkPixbuf. Fix users of gimp_pixbuf_create_buffer()
to make the least possible copies. Patch modified by Mitch.
2014-02-23 00:49:56 +01:00
Daniel Sabo ff9c91ce6f Use gegl_malloc in GimpTempBuf
Which allocates 16 byte aligned memory for SSE code.
2013-06-25 20:40:27 -07:00
Michael Natterer 1bbd3d40a8 app: make the GimpTempBuf struct private and add accessors 2012-05-02 17:51:12 +02:00
Michael Natterer 685a48d59a app: move gimp_gegl_buffer_get_temp_buf() to gimptempbuf.[ch] 2012-05-02 17:51:02 +02:00
Michael Natterer 324f594fa9 app: remove "x" and "y" members from GimpTempBuf
and generally clean up things a bit.
2012-05-02 17:51:02 +02:00
Michael Natterer 631134180e app: swallow gimp_temp_buf_demultiply() into gimp_image_get_new_preview() 2012-05-02 17:51:01 +02:00
Michael Natterer bdf6b48138 app: move GimpTempBuf from base/ to core/
and forget about include policy in base/, it's scheduled for removal
anyway.
2012-05-02 17:51:01 +02:00