parent
48894613f9
commit
98c429c657
@ -1,37 +0,0 @@
|
||||
diff --git a/PIL/Image.py b/PIL/Image.py
|
||||
index cafc5a2..794ee49 100644
|
||||
--- a/PIL/Image.py
|
||||
+++ b/PIL/Image.py
|
||||
@@ -718,7 +718,7 @@ class Image:
|
||||
if self.mode == "L" and mode == "RGBA" and "transparency" in self.info:
|
||||
from PIL import ImagePalette
|
||||
self.mode = "P"
|
||||
- bytePalette = bytes([i//3 for i in range(768)])
|
||||
+ bytePalette = bytes(bytearray([i//3 for i in range(768)]))
|
||||
self.palette = ImagePalette.raw("RGB", bytePalette)
|
||||
self.palette.dirty = 1
|
||||
self.load()
|
||||
diff --git a/_imaging.c b/_imaging.c
|
||||
index 2ee7eef..6ec7346 100644
|
||||
--- a/_imaging.c
|
||||
+++ b/_imaging.c
|
||||
@@ -286,6 +286,7 @@ static const char* wrong_mode = "unrecognized image mode";
|
||||
static const char* wrong_raw_mode = "unrecognized raw mode";
|
||||
static const char* outside_image = "image index out of range";
|
||||
static const char* outside_palette = "palette index out of range";
|
||||
+static const char* wrong_palette_size = "invalid palette size";
|
||||
static const char* no_palette = "image has no palette";
|
||||
static const char* readonly = "image is readonly";
|
||||
/* static const char* no_content = "image has no content"; */
|
||||
@@ -1412,6 +1413,11 @@ _putpalette(ImagingObject* self, PyObject* args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if ( palettesize * 8 / bits > 256) {
|
||||
+ PyErr_SetString(PyExc_ValueError, wrong_palette_size);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
ImagingPaletteDelete(self->image->palette);
|
||||
|
||||
strcpy(self->image->mode, "P");
|
@ -1,12 +0,0 @@
|
||||
diff -rupN python-imaging-Pillow-75af7e0/_webp.c python-imaging-Pillow-75af7e0-new/_webp.c
|
||||
--- python-imaging-Pillow-75af7e0/_webp.c 2013-07-02 14:52:49.000000000 +0200
|
||||
+++ python-imaging-Pillow-75af7e0-new/_webp.c 2013-08-29 13:03:34.558822782 +0200
|
||||
@@ -17,7 +17,7 @@ PyObject* WebPEncode_wrapper(PyObject* s
|
||||
Py_ssize_t size;
|
||||
size_t ret_size;
|
||||
|
||||
- if (!PyArg_ParseTuple(args, "s#nifs",(char**)&rgb, &size, &width, &height, &quality_factor, &mode)) {
|
||||
+ if (!PyArg_ParseTuple(args, "s#iifs",(char**)&rgb, &size, &width, &height, &quality_factor, &mode)) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
Loading…
Reference in new issue