[1/4] libc/iconv: Detect CES handler loading failure

Message ID 20200709235848.3496713-1-keithp@keithp.com
State Accepted
Commit 6c772f4547c5eea46fb814806509b78f08dfdfa1
Headers show
Series
  • [1/4] libc/iconv: Detect CES handler loading failure
Related show

Commit Message

Keith Packard via Newlib July 9, 2020, 11:58 p.m.
Fix the code checking for character set loading failure so that
it checks the return value from the init function.

Signed-off-by: Keith Packard <keithp@keithp.com>

---
 newlib/libc/iconv/ces/euc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0

Comments

Keith Packard via Newlib July 10, 2020, 10:05 a.m. | #1
On Jul  9 16:58, Keith Packard via Newlib wrote:
> Fix the code checking for character set loading failure so that

> it checks the return value from the init function.

> 

> Signed-off-by: Keith Packard <keithp@keithp.com>

> ---

>  newlib/libc/iconv/ces/euc.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c

> index 29d36f941..ebd7091b0 100644

> --- a/newlib/libc/iconv/ces/euc.c

> +++ b/newlib/libc/iconv/ces/euc.c

> @@ -306,7 +306,7 @@ ok:

>        data->data[i] = _iconv_to_ucs_ces_handlers_table.init (

>                                                          rptr,

>                                                          data->desc[i].csname);

> -      if (data->data == NULL)

> +      if (data->data[i] == NULL)

>          goto error;

>      } 

>  

> -- 

> 2.27.0


Pushed.

Just, please create patchsets with cover letter.  It's better for
replies in terms of the entire patchset vs. replies to a single
patch.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Keith Packard via Newlib July 11, 2020, 12:26 a.m. | #2
Corinna Vinschen <vinschen@redhat.com> writes:

> Just, please create patchsets with cover letter.  It's better for

> replies in terms of the entire patchset vs. replies to a single

> patch.


Will do. Thanks for the reminder! And thanks for accepting these patches.

-- 
-keith

Patch

diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c
index 29d36f941..ebd7091b0 100644
--- a/newlib/libc/iconv/ces/euc.c
+++ b/newlib/libc/iconv/ces/euc.c
@@ -306,7 +306,7 @@  ok:
       data->data[i] = _iconv_to_ucs_ces_handlers_table.init (
                                                         rptr,
                                                         data->desc[i].csname);
-      if (data->data == NULL)
+      if (data->data[i] == NULL)
         goto error;
     }