public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* windres: Optional dialog control data immediately follow the control description without alignment.
@ 2017-01-09 12:19 Dmitry Timoshkov
  2017-01-17  3:05 ` Dmitry Timoshkov
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Timoshkov @ 2017-01-09 12:19 UTC (permalink / raw)
  To: binutils

Hi,

this patch fixes the dialog optional control data generation and reading
in windres.

Thanks.
---
 binutils/ChangeLog                                     |  8 ++++++++
 binutils/resbin.c                                      |  3 ---
 binutils/testsuite/binutils-all/windres/controldata.rc |  6 ++++++
 .../testsuite/binutils-all/windres/controldata.rsd     | 18 ++++++++++++++++++
 4 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rc
 create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rsd

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b5e82fe..7e117e9 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2017-01-09  Dmitry Timoshkov  <dmitry@baikal.ru>
+
+	* resbin.c: Optional dialog control data immediately follow
+	the control description without alignment.
+	* testsuite/binutils-all/windres/controldata.rc: New test.
+	source.
+	* testsuite/binutils-all/windres/controldata.rsd: New test.
+
 2017-01-09  Alan Modra  <amodra@gmail.com>
 
 	* readelf.c (process_section_headers): Correct .rel.dyn/.rela.dyn
diff --git a/binutils/resbin.c b/binutils/resbin.c
index f836a5a..59072d6 100644
--- a/binutils/resbin.c
+++ b/binutils/resbin.c
@@ -574,8 +574,6 @@ bin_to_res_dialog (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length
 	dc->data = NULL;
       else
 	{
-	  off = (off + 3) &~ 3;
-
 	  if (length < off + datalen)
 	    toosmall (_("dialog control data"));
 
@@ -1582,7 +1580,6 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, const rc_dialog *dialog
 	{
 	  rc_uint_type saved_off = off;
 	  rc_uint_type old_off;
-	  off += (4 - ((off - off_delta) & 3)) & 3;
 
 	  old_off = off;
 	  off = res_to_bin_rcdata (wrbfd, off, dc->data);
diff --git a/binutils/testsuite/binutils-all/windres/controldata.rc b/binutils/testsuite/binutils-all/windres/controldata.rc
new file mode 100644
index 0000000..67b8df2
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/controldata.rc
@@ -0,0 +1,6 @@
+1 DIALOGEX DISCARDABLE 0, 0, 200, 150
+STYLE 0
+BEGIN
+  CONTROL "evenlengthtext", -1, "TESTCONTROL", 0x50810000, 10,10,100,50 { 1,2,3,4,5 }
+  CONTROL "oddlengthtext", -1, "TESTCONTROL", 0x50810000, 10,60,100,50 { 1,2,3,4,5 }
+END
diff --git a/binutils/testsuite/binutils-all/windres/controldata.rsd b/binutils/testsuite/binutils-all/windres/controldata.rsd
new file mode 100644
index 0000000..1357e05
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/controldata.rsd
@@ -0,0 +1,18 @@
+ 0000 00000000 20000000 ffff0000 ffff0000  .... ...........
+ 0010 00000000 00000000 00000000 00000000  ................
+ 0020 d4000000 20000000 ffff0500 ffff0100  .... ...........
+ 0030 00000000 30100904 00000000 00000000  ....0...........
+ 0040 0100ffff 00000000 00000000 00000000  ................
+ 0050 02000000 0000c800 96000000 00000000  ................
+ 0060 00000000 00000000 00008150 0a000a00  ...........P....
+ 0070 64003200 ffffffff 54004500 53005400  d.2.....T.E.S.T.
+ 0080 43004f00 4e005400 52004f00 4c000000  C.O.N.T.R.O.L...
+ 0090 65007600 65006e00 6c006500 6e006700  e.v.e.n.l.e.n.g.
+ 00a0 74006800 74006500 78007400 00000a00  t.h.t.e.x.t.....
+ 00b0 01000200 03000400 05000000 00000000  ................
+ 00c0 00000000 00008150 0a003c00 64003200  .......P..<.d.2.
+ 00d0 ffffffff 54004500 53005400 43004f00  ....T.E.S.T.C.O.
+ 00e0 4e005400 52004f00 4c000000 6f006400  N.T.R.O.L...o.d.
+ 00f0 64006c00 65006e00 67007400 68007400  d.l.e.n.g.t.h.t.
+ 0100 65007800 74000000 0a000100 02000300  e.x.t...........
+ 0110 04000500                             ....            
-- 
2.10.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: windres: Optional dialog control data immediately follow the control description without alignment.
  2017-01-09 12:19 windres: Optional dialog control data immediately follow the control description without alignment Dmitry Timoshkov
@ 2017-01-17  3:05 ` Dmitry Timoshkov
  2017-01-18 11:42   ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Timoshkov @ 2017-01-17  3:05 UTC (permalink / raw)
  To: binutils

Hi,

Is there anything that could be done to get this patch reviewed, and if
it's ok committed?

Dmitry Timoshkov <dmitry@baikal.ru> wrote:

> Hi,
> 
> this patch fixes the dialog optional control data generation and reading
> in windres.
> 
> Thanks.
> ---
>  binutils/ChangeLog                                     |  8 ++++++++
>  binutils/resbin.c                                      |  3 ---
>  binutils/testsuite/binutils-all/windres/controldata.rc |  6 ++++++
>  .../testsuite/binutils-all/windres/controldata.rsd     | 18 ++++++++++++++++++
>  4 files changed, 32 insertions(+), 3 deletions(-)
>  create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rc
>  create mode 100644 binutils/testsuite/binutils-all/windres/controldata.rsd
> 
> diff --git a/binutils/ChangeLog b/binutils/ChangeLog
> index b5e82fe..7e117e9 100644
> --- a/binutils/ChangeLog
> +++ b/binutils/ChangeLog
> @@ -1,3 +1,11 @@
> +2017-01-09  Dmitry Timoshkov  <dmitry@baikal.ru>
> +
> +	* resbin.c: Optional dialog control data immediately follow
> +	the control description without alignment.
> +	* testsuite/binutils-all/windres/controldata.rc: New test.
> +	source.
> +	* testsuite/binutils-all/windres/controldata.rsd: New test.
> +
>  2017-01-09  Alan Modra  <amodra@gmail.com>
>  
>  	* readelf.c (process_section_headers): Correct .rel.dyn/.rela.dyn
> diff --git a/binutils/resbin.c b/binutils/resbin.c
> index f836a5a..59072d6 100644
> --- a/binutils/resbin.c
> +++ b/binutils/resbin.c
> @@ -574,8 +574,6 @@ bin_to_res_dialog (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length
>  	dc->data = NULL;
>        else
>  	{
> -	  off = (off + 3) &~ 3;
> -
>  	  if (length < off + datalen)
>  	    toosmall (_("dialog control data"));
>  
> @@ -1582,7 +1580,6 @@ res_to_bin_dialog (windres_bfd *wrbfd, rc_uint_type off, const rc_dialog *dialog
>  	{
>  	  rc_uint_type saved_off = off;
>  	  rc_uint_type old_off;
> -	  off += (4 - ((off - off_delta) & 3)) & 3;
>  
>  	  old_off = off;
>  	  off = res_to_bin_rcdata (wrbfd, off, dc->data);
> diff --git a/binutils/testsuite/binutils-all/windres/controldata.rc b/binutils/testsuite/binutils-all/windres/controldata.rc
> new file mode 100644
> index 0000000..67b8df2
> --- /dev/null
> +++ b/binutils/testsuite/binutils-all/windres/controldata.rc
> @@ -0,0 +1,6 @@
> +1 DIALOGEX DISCARDABLE 0, 0, 200, 150
> +STYLE 0
> +BEGIN
> +  CONTROL "evenlengthtext", -1, "TESTCONTROL", 0x50810000, 10,10,100,50 { 1,2,3,4,5 }
> +  CONTROL "oddlengthtext", -1, "TESTCONTROL", 0x50810000, 10,60,100,50 { 1,2,3,4,5 }
> +END
> diff --git a/binutils/testsuite/binutils-all/windres/controldata.rsd b/binutils/testsuite/binutils-all/windres/controldata.rsd
> new file mode 100644
> index 0000000..1357e05
> --- /dev/null
> +++ b/binutils/testsuite/binutils-all/windres/controldata.rsd
> @@ -0,0 +1,18 @@
> + 0000 00000000 20000000 ffff0000 ffff0000  .... ...........
> + 0010 00000000 00000000 00000000 00000000  ................
> + 0020 d4000000 20000000 ffff0500 ffff0100  .... ...........
> + 0030 00000000 30100904 00000000 00000000  ....0...........
> + 0040 0100ffff 00000000 00000000 00000000  ................
> + 0050 02000000 0000c800 96000000 00000000  ................
> + 0060 00000000 00000000 00008150 0a000a00  ...........P....
> + 0070 64003200 ffffffff 54004500 53005400  d.2.....T.E.S.T.
> + 0080 43004f00 4e005400 52004f00 4c000000  C.O.N.T.R.O.L...
> + 0090 65007600 65006e00 6c006500 6e006700  e.v.e.n.l.e.n.g.
> + 00a0 74006800 74006500 78007400 00000a00  t.h.t.e.x.t.....
> + 00b0 01000200 03000400 05000000 00000000  ................
> + 00c0 00000000 00008150 0a003c00 64003200  .......P..<.d.2.
> + 00d0 ffffffff 54004500 53005400 43004f00  ....T.E.S.T.C.O.
> + 00e0 4e005400 52004f00 4c000000 6f006400  N.T.R.O.L...o.d.
> + 00f0 64006c00 65006e00 67007400 68007400  d.l.e.n.g.t.h.t.
> + 0100 65007800 74000000 0a000100 02000300  e.x.t...........
> + 0110 04000500                             ....            
> -- 
> 2.10.1
> 


-- 
Dmitry.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: windres: Optional dialog control data immediately follow the control description without alignment.
  2017-01-17  3:05 ` Dmitry Timoshkov
@ 2017-01-18 11:42   ` Nick Clifton
  2017-01-18 11:58     ` Dmitry Timoshkov
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2017-01-18 11:42 UTC (permalink / raw)
  To: Dmitry Timoshkov, binutils

Hi Dmitry,

> Is there anything that could be done to get this patch reviewed, and if
> it's ok committed?

Sorry - my bad - the patch was in my queue, but I was distracted by other things.

The patch is fine - I have gobe ahead and applied it for you.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: windres: Optional dialog control data immediately follow the control description without alignment.
  2017-01-18 11:42   ` Nick Clifton
@ 2017-01-18 11:58     ` Dmitry Timoshkov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Timoshkov @ 2017-01-18 11:58 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Nick Clifton <nickc@redhat.com> wrote:

> Hi Dmitry,
> 
> > Is there anything that could be done to get this patch reviewed, and if
> > it's ok committed?
> 
> Sorry - my bad - the patch was in my queue, but I was distracted by other things.
> 
> The patch is fine - I have gone ahead and applied it for you.

Thanks!

-- 
Dmitry.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-18 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 12:19 windres: Optional dialog control data immediately follow the control description without alignment Dmitry Timoshkov
2017-01-17  3:05 ` Dmitry Timoshkov
2017-01-18 11:42   ` Nick Clifton
2017-01-18 11:58     ` Dmitry Timoshkov

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).