Hi,

This patch is causing the unit tests to fail, and it seems that evas can no
longer load the in-tree wbmp files--a regression.

In the future, please run unit tests before landing patches.


Thanks,
Mike

On Tue, Apr 23, 2019 at 6:19 AM Hermet Park <hermetp...@gmail.com> wrote:

> hermet pushed a commit to branch master.
>
>
> http://git.enlightenment.org/core/efl.git/commit/?id=68fe9ec6bf60b4730ad7fdbf2698dc7aa130b94d
>
> commit 68fe9ec6bf60b4730ad7fdbf2698dc7aa130b94d
> Author: Hermet Park <hermetp...@gmail.com>
> Date:   Tue Apr 23 19:04:21 2019 +0900
>
>     evas image: check format more strong way for wbmp.
>
>     wbmp format doesn't have any tags for verifying file header,
>     It's easy to pass other format headers if they have the first 1 byte
> 0x0,
>
>     This ocassionally brings wrong result (= succeeed loading image),
>     if unknown file format is tried.
>
>     So, to make it sure, here verify the size of image additionally.
>     if the image size is not expected, It returns fail as the result.
>
>     This problem is actually happened in this scenario.
>
>     open any mpeg file with elm_image.
>     elm_image_file_set() will return true though it fails to read data.
>     since wbmp make it pass to succeed.
>
>     @fix
> ---
>  .../evas/image_loaders/wbmp/evas_image_load_wbmp.c   | 20
> +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
> b/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
> index 633afe9567..00e67f3713 100644
> --- a/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
> +++ b/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
> @@ -73,6 +73,15 @@ evas_image_load_file_head_wbmp(void *loader_data,
>     position++; /* skipping one byte */
>     if (read_mb(&w, map, length, &position) < 0) goto bail;
>     if (read_mb(&h, map, length, &position) < 0) goto bail;
> +
> +   /* Wbmp header identifier is too weak....
> +      Here checks size validation whether it's acutal wbmp or not. */
> +   if (((w * h) >> 3) + position != length)
> +     {
> +        *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
> +        goto bail;
> +     }
> +
>     if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
>         IMG_TOO_BIG(w, h))
>       {
> @@ -116,11 +125,20 @@ evas_image_load_file_data_wbmp(void *loader_data,
>     if (!map) goto bail;
>
>     if (read_mb(&type, map, length, &position) < 0) goto bail;
> +
> +   if (type != 0)
> +     {
> +        *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
> +        goto bail;
> +     }
> +
>     position++; /* skipping one byte */
>     if (read_mb(&w, map, length, &position) < 0) goto bail;
>     if (read_mb(&h, map, length, &position) < 0) goto bail;
>
> -   if (type != 0)
> +   /* Wbmp header identifier is too weak....
> +      Here checks size validation whether it's acutal wbmp or not. */
> +   if (((w * h) >> 3) + position != length)
>       {
>          *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
>          goto bail;
>
> --
>
>
>

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to