summaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-08 03:36:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-08 03:36:54 +0000
commitfd614aea06e1b83e7bd486194e913bed5a224de0 (patch)
treecfd202d18f09a8d0e26759143ae9eb23268ca095 /pack.c
parentfbd870b4f423061efc85e3b42486761fbc12cccb (diff)
downloadruby-fd614aea06e1b83e7bd486194e913bed5a224de0.tar.gz
ruby-fd614aea06e1b83e7bd486194e913bed5a224de0.tar.xz
ruby-fd614aea06e1b83e7bd486194e913bed5a224de0.zip
* pack.c (pack_pack): pointer modification check before each
iteration. [ruby-dev:24445] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pack.c b/pack.c
index fdca0ed02..5e7ae09e2 100644
--- a/pack.c
+++ b/pack.c
@@ -464,6 +464,9 @@ pack_pack(ary, fmt)
#define NEXTFROM (items-- > 0 ? RARRAY(ary)->ptr[idx++] : (rb_raise(rb_eArgError, toofew),0))
while (p < pend) {
+ if (RSTRING(fmt)->ptr + RSTRING(fmt)->len != pend) {
+ rb_raise(rb_eRuntimeError, "format string modified");
+ }
type = *p++; /* get data type */
#ifdef NATINT_PACK
natint = 0;