* [ruby-core:62737] [ruby-trunk - Bug #9861] [Assigned] BSD_vfprintf precsion doesn't work at shorter string
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
@ 2014-05-25 2:49 ` nobu
2014-05-25 2:56 ` [ruby-core:62740] [ruby-trunk - Bug #9861] [Closed] " nobu
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2014-05-25 2:49 UTC (permalink / raw
To: ruby-core
Issue #9861 has been reported by Nobuyoshi Nakada.
----------------------------------------
Bug #9861: BSD_vfprintf precsion doesn't work at shorter string
https://bugs.ruby-lang.org/issues/9861
* Author: Nobuyoshi Nakada
* Status: Assigned
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: 1.4.0 or later
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
`ruby_snprintf`などで`"%s"`に精度を指定してその精度よりも短い文字列を渡すと、本来の長さが無視されて精度まで`'\0'`が詰められます。
~~~C
/* t.c */
#include <ruby/ruby.h>
int main(void)
{
char buf[26];
ruby_snprintf(buf, sizeof(buf), "%.2s", "s");
printf("[%.2x][%.2x][%.2x]\n", buf[0], buf[1], buf[2]);
return 0;
}
~~~
~~~
$ make t LDLIBS='$(LIBRUBYARG_STATIC) $(LIBS)'
$ ./t
[73][00][00]
~~~
最初の`missing/vsnprintf.c`からあるようなので、1.4.0以降すべてのバージョンにあるバグだと思います。
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:62740] [ruby-trunk - Bug #9861] [Closed] BSD_vfprintf precsion doesn't work at shorter string
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
2014-05-25 2:49 ` [ruby-core:62737] [ruby-trunk - Bug #9861] [Assigned] BSD_vfprintf precsion doesn't work at shorter string nobu
@ 2014-05-25 2:56 ` nobu
2014-06-27 8:46 ` [ruby-core:63363] [ruby-trunk - Bug #9861] " usa
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2014-05-25 2:56 UTC (permalink / raw
To: ruby-core
Issue #9861 has been updated by Nobuyoshi Nakada.
Status changed from Assigned to Closed
% Done changed from 0 to 100
Applied in changeset r46098.
----------
vsnprintf.c: fix string precision
* vsnprintf.c (BSD_vfprintf): fix string width when precision is
given. as the result of `memchr` is NULL or its offset from the
start cannot exceed the size, the comparison was always false.
[ruby-core:62737] [Bug #9861]
----------------------------------------
Bug #9861: BSD_vfprintf precsion doesn't work at shorter string
https://bugs.ruby-lang.org/issues/9861#change-46863
* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: 1.4.0 or later
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
`ruby_snprintf`などで`"%s"`に精度を指定してその精度よりも短い文字列を渡すと、本来の長さが無視されて精度まで`'\0'`が詰められます。
~~~C
/* t.c */
#include <ruby/ruby.h>
int main(void)
{
char buf[26];
ruby_snprintf(buf, sizeof(buf), "%.2s", "s");
printf("[%.2x][%.2x][%.2x]\n", buf[0], buf[1], buf[2]);
return 0;
}
~~~
~~~
$ make t LDLIBS='$(LIBRUBYARG_STATIC) $(LIBS)'
$ ./t
[73][00][00]
~~~
最初の`missing/vsnprintf.c`からあるようなので、1.4.0以降すべてのバージョンにあるバグだと思います。
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:63363] [ruby-trunk - Bug #9861] BSD_vfprintf precsion doesn't work at shorter string
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
2014-05-25 2:49 ` [ruby-core:62737] [ruby-trunk - Bug #9861] [Assigned] BSD_vfprintf precsion doesn't work at shorter string nobu
2014-05-25 2:56 ` [ruby-core:62740] [ruby-trunk - Bug #9861] [Closed] " nobu
@ 2014-06-27 8:46 ` usa
2014-06-27 8:46 ` [ruby-core:63364] " usa
2014-06-29 17:17 ` [ruby-core:63402] " nagachika00
4 siblings, 0 replies; 5+ messages in thread
From: usa @ 2014-06-27 8:46 UTC (permalink / raw
To: ruby-core
Issue #9861 has been updated by Usaku NAKAMURA.
backported into `ruby_2_0_0` at r46582.
----------------------------------------
Bug #9861: BSD_vfprintf precsion doesn't work at shorter string
https://bugs.ruby-lang.org/issues/9861#change-47414
* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: 1.4.0 or later
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
`ruby_snprintf`などで`"%s"`に精度を指定してその精度よりも短い文字列を渡すと、本来の長さが無視されて精度まで`'\0'`が詰められます。
~~~C
/* t.c */
#include <ruby/ruby.h>
int main(void)
{
char buf[26];
ruby_snprintf(buf, sizeof(buf), "%.2s", "s");
printf("[%.2x][%.2x][%.2x]\n", buf[0], buf[1], buf[2]);
return 0;
}
~~~
~~~
$ make t LDLIBS='$(LIBRUBYARG_STATIC) $(LIBS)'
$ ./t
[73][00][00]
~~~
最初の`missing/vsnprintf.c`からあるようなので、1.4.0以降すべてのバージョンにあるバグだと思います。
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:63364] [ruby-trunk - Bug #9861] BSD_vfprintf precsion doesn't work at shorter string
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
` (2 preceding siblings ...)
2014-06-27 8:46 ` [ruby-core:63363] [ruby-trunk - Bug #9861] " usa
@ 2014-06-27 8:46 ` usa
2014-06-29 17:17 ` [ruby-core:63402] " nagachika00
4 siblings, 0 replies; 5+ messages in thread
From: usa @ 2014-06-27 8:46 UTC (permalink / raw
To: ruby-core
Issue #9861 has been updated by Usaku NAKAMURA.
Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: DONE, 2.1: REQUIRED
----------------------------------------
Bug #9861: BSD_vfprintf precsion doesn't work at shorter string
https://bugs.ruby-lang.org/issues/9861#change-47415
* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: 1.4.0 or later
* Backport: 2.0.0: DONE, 2.1: REQUIRED
----------------------------------------
`ruby_snprintf`などで`"%s"`に精度を指定してその精度よりも短い文字列を渡すと、本来の長さが無視されて精度まで`'\0'`が詰められます。
~~~C
/* t.c */
#include <ruby/ruby.h>
int main(void)
{
char buf[26];
ruby_snprintf(buf, sizeof(buf), "%.2s", "s");
printf("[%.2x][%.2x][%.2x]\n", buf[0], buf[1], buf[2]);
return 0;
}
~~~
~~~
$ make t LDLIBS='$(LIBRUBYARG_STATIC) $(LIBS)'
$ ./t
[73][00][00]
~~~
最初の`missing/vsnprintf.c`からあるようなので、1.4.0以降すべてのバージョンにあるバグだと思います。
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:63402] [ruby-trunk - Bug #9861] BSD_vfprintf precsion doesn't work at shorter string
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
` (3 preceding siblings ...)
2014-06-27 8:46 ` [ruby-core:63364] " usa
@ 2014-06-29 17:17 ` nagachika00
4 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2014-06-29 17:17 UTC (permalink / raw
To: ruby-core
Issue #9861 has been updated by Tomoyuki Chikanaga.
Backport changed from 2.0.0: DONE, 2.1: REQUIRED to 2.0.0: DONE, 2.1: DONE
Backported into `ruby_2_1` branch at r46611.
----------------------------------------
Bug #9861: BSD_vfprintf precsion doesn't work at shorter string
https://bugs.ruby-lang.org/issues/9861#change-47445
* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: 1.4.0 or later
* Backport: 2.0.0: DONE, 2.1: DONE
----------------------------------------
`ruby_snprintf`などで`"%s"`に精度を指定してその精度よりも短い文字列を渡すと、本来の長さが無視されて精度まで`'\0'`が詰められます。
~~~C
/* t.c */
#include <ruby/ruby.h>
int main(void)
{
char buf[26];
ruby_snprintf(buf, sizeof(buf), "%.2s", "s");
printf("[%.2x][%.2x][%.2x]\n", buf[0], buf[1], buf[2]);
return 0;
}
~~~
~~~
$ make t LDLIBS='$(LIBRUBYARG_STATIC) $(LIBS)'
$ ./t
[73][00][00]
~~~
最初の`missing/vsnprintf.c`からあるようなので、1.4.0以降すべてのバージョンにあるバグだと思います。
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-29 16:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-9861.20140525024949@ruby-lang.org>
2014-05-25 2:49 ` [ruby-core:62737] [ruby-trunk - Bug #9861] [Assigned] BSD_vfprintf precsion doesn't work at shorter string nobu
2014-05-25 2:56 ` [ruby-core:62740] [ruby-trunk - Bug #9861] [Closed] " nobu
2014-06-27 8:46 ` [ruby-core:63363] [ruby-trunk - Bug #9861] " usa
2014-06-27 8:46 ` [ruby-core:63364] " usa
2014-06-29 17:17 ` [ruby-core:63402] " nagachika00
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).