From 9d3fddaa634752fa29d9562e28d492f2db58aeea Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 21 Oct 2006 00:04:57 +0000 Subject: [PATCH] Bugfix: bidi_l2v() returned a pointer to value on the stack when the argument was an empty string. * Don't protect against NULL pointer, that would be a bug in the caller. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11282 a1c6a512-1295-4272-9138-f99709370657 --- firmware/bidi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/bidi.c b/firmware/bidi.c index d2458e8963..a6f6b8c5d9 100644 --- a/firmware/bidi.c +++ b/firmware/bidi.c @@ -138,15 +138,15 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation) //long max_chars=0; //int begin, end, char_count, orig_begin; - if (!str || !*str) - return &(unsigned short){0}; - //tmp = str; target = tmp = utf16_buf; while (*str) str = utf8decode(str, target++); *target = 0; + if (target == utf16_buf) /* empty string */ + return target; + /* properly join any arabic chars */ arabjoin(utf16_buf, length);