Re: [PATCH 10/18] Do proper conversion from UTF-16 to UTF-8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/22/2013 04:07 PM, Roy Franz wrote:
> On Sun, Sep 22, 2013 at 3:54 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>> Sorry this version is broken and doesn't even compile due to remaining options_size references.
> 
> I compiled and tested this series on both x86_64 (using OVMF) and on
> the ARM simulator.  I just doubled checked
> my kernel .config to verify this was not being omitted and I'm pretty
> sure this doesn't have any compilation problems.
> I did make a few changes to get the untested version you sent out to
> compile, but they all seemed to be straightforward typo type fixes.
> I'll gladly address any defects in this patch, but I don't see an
> compilation problems.
> 

Ah yes, I see now... you fixed up the compile problem but did so
incorrectly.

      int load_options_size = image->load_options_size / 2; /* ASCII */

This is a number of UTF-16 chars, the comment is completely wrong;

-              while (*s2 && *s2 != '\n' && options_size <
load_options_size) {
+              while (*s2 && *s2 != '\n' && options_bytes <
load_options_size) {
+                      options_bytes += efi_utf8_bytes(*s2);
                      s2++;
-                      options_size++;
              }
+              options_chars = s2 - options;

You can't compare options_bytes against load_options_size; the latter
being a UTF-16 shortword count.

So the loop really needs to update options_chars in the loop to compare
it against load_options_size:

	while (*s2 && *s2 != '\n' && options_chars < load_options_size) {
		options_bytes += efi_utf8_bytes(*s2++);
		option_chars++;
	}

	-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux