[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:63364] [ruby-trunk - Bug #9861] BSD_vfprintf precsion doesn't work at shorter string
From:
usa@...
Date:
2014-06-27 08:46:39 UTC
List:
ruby-core #63364
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/