From: fweimer@redhat.com (Florian Weimer)
To: libc-alpha@sourceware.org
Subject: [PATCH] iconv: Avoid writable data and relocations in IBM charsets
Date: Wed, 26 Oct 2016 09:15:00 -0000 [thread overview]
Message-ID: <20161026091538.A7628439942E0@oldenburg.str.redhat.com> (raw)
The IBM930, IBM933, IBM935 and IBM939 converters defined lookup
tables which were not constant. They also contained an
unnecessary pointer indirection.
2016-10-26 Florian Weimer <fweimer@redhat.com>
* iconvdata/ibm930.h (__ucs4_to_ibm930sb): Switch from writable
array of string pointers to constant array of two-character
arrays.
* iconvdata/ibm933.h (__ucs4_to_ibm933sb): Likewise.
* iconvdata/ibm935.h (__ucs4_to_ibm935sb): Likewise.
* iconvdata/ibm939.h (__ucs4_to_ibm939sb): Likewise.
diff --git a/iconvdata/ibm930.h b/iconvdata/ibm930.h
index 1afda56..1f2d87d 100644
--- a/iconvdata/ibm930.h
+++ b/iconvdata/ibm930.h
@@ -1499,7 +1499,7 @@ static const struct gap __ucs4_to_ibm930sb_idx[] =
{ .start = 0xffff, .end = 0xffff, .idx = 0 }
};
-static const char * __ucs4_to_ibm930sb[] =
+static const char __ucs4_to_ibm930sb[][2] =
{
"\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16",
"\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11",
diff --git a/iconvdata/ibm933.h b/iconvdata/ibm933.h
index cb00137..4b9317a 100644
--- a/iconvdata/ibm933.h
+++ b/iconvdata/ibm933.h
@@ -3371,7 +3371,7 @@ static const struct gap __ucs4_to_ibm933sb_idx[] =
{ .start = 0xffff, .end = 0xffff, .idx = 0 }
};
-static const char *__ucs4_to_ibm933sb[] =
+static const char __ucs4_to_ibm933sb[][2] =
{
"\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16",
"\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11",
diff --git a/iconvdata/ibm935.h b/iconvdata/ibm935.h
index f7a96e9..b178f59 100644
--- a/iconvdata/ibm935.h
+++ b/iconvdata/ibm935.h
@@ -1282,7 +1282,7 @@ static const struct gap __ucs4_to_ibm935sb_idx[] =
{ .start = 0xffff, .end = 0xffff, .idx = 0 }
};
-static const char *__ucs4_to_ibm935sb[] =
+static const char __ucs4_to_ibm935sb[][2] =
{
"\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16",
"\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11",
diff --git a/iconvdata/ibm939.h b/iconvdata/ibm939.h
index bb8a8de..a9d8bf8 100644
--- a/iconvdata/ibm939.h
+++ b/iconvdata/ibm939.h
@@ -1499,7 +1499,7 @@ static const struct gap __ucs4_to_ibm939sb_idx[] =
{ .start = 0xffff, .end = 0xffff, .idx = 0 }
};
-static const char * __ucs4_to_ibm939sb[] =
+static const char __ucs4_to_ibm939sb[][2] =
{
"\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16",
"\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11",
next reply other threads:[~2016-10-26 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 9:15 Florian Weimer [this message]
2016-10-26 9:23 ` Andreas Schwab
2016-10-26 10:00 ` Florian Weimer
2016-10-26 10:21 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161026091538.A7628439942E0@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).