2019-05-12 08:59:56

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] unicode: add missing check for an error return from utf8lookup()

Signed-off-by: Theodore Ts'o <[email protected]>
Cc: Gabriel Krisman Bertazi <[email protected]>
---
fs/unicode/utf8-norm.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/unicode/utf8-norm.c b/fs/unicode/utf8-norm.c
index 20d440c3f2db..801ed6d2ea37 100644
--- a/fs/unicode/utf8-norm.c
+++ b/fs/unicode/utf8-norm.c
@@ -714,6 +714,8 @@ int utf8byte(struct utf8cursor *u8c)
}

leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
+ if (!leaf)
+ return -1;
ccc = LEAF_CCC(leaf);
}

--
2.19.1


2019-05-12 21:19:10

by Gabriel Krisman Bertazi

[permalink] [raw]
Subject: Re: [PATCH] unicode: add missing check for an error return from utf8lookup()

"Theodore Ts'o" <[email protected]> writes:

> Signed-off-by: Theodore Ts'o <[email protected]>
> Cc: Gabriel Krisman Bertazi <[email protected]>

Acked-by: Gabriel Krisman Bertazi <[email protected]>

> ---
> fs/unicode/utf8-norm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/unicode/utf8-norm.c b/fs/unicode/utf8-norm.c
> index 20d440c3f2db..801ed6d2ea37 100644
> --- a/fs/unicode/utf8-norm.c
> +++ b/fs/unicode/utf8-norm.c
> @@ -714,6 +714,8 @@ int utf8byte(struct utf8cursor *u8c)
> }
>
> leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
> + if (!leaf)
> + return -1;
> ccc = LEAF_CCC(leaf);
> }

--
Gabriel Krisman Bertazi