Re: [patch 1/2] HFS+: Refactor ASCII to unicode conversion routine for later reuse

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Duane Griffin
Date: Tuesday, June 26, 2007 - 3:03 am

On 25/06/07, Roman Zippel <zippel@linux-m68k.org> wrote:

Ah, nice one! Returning the pointer into the table is a much nicer way
of doing things.


Andrew's comments about the loop in the second patch apply here too, I
think. The original code did have a check for this condition, so I
guess it is a potential problem. How about this (on top of your
version of the patches):

Index: linux-2.6.21.5/fs/hfsplus/unicode.c
===================================================================
--- linux-2.6.21.5.orig/fs/hfsplus/unicode.c
+++ linux-2.6.21.5/fs/hfsplus/unicode.c
@@ -280,7 +280,9 @@ static inline u16 *decompose_unichar(wch
                return NULL;

        off = hfsplus_decompose_table[off + (uc & 0xf)];
-       *size = off & 3;
+       if ((*size = off & 3) == 0)
+               return NULL;
+
        return hfsplus_decompose_table + (off / 4);
 }

I'm using gmail to send this, so it will mess up the tabs I'm afraid :(


Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [patch 1/2] HFS+: Refactor ASCII to unicode conversion ..., Duane Griffin, (Tue Jun 26, 3:03 am)