digest.c: GC guard
* ext/digest/digest.c (hexencode_str_new, rb_digest_base_update): prevent argument strings from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8147bd1e49
commit
ac9d6b050b
@ -124,6 +124,8 @@ hexencode_str_new(VALUE str_digest)
|
|||||||
p[i + i + 1] = hex[byte & 0x0f];
|
p[i + i + 1] = hex[byte & 0x0f];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_GC_GUARD(str_digest);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,6 +625,7 @@ rb_digest_base_update(VALUE self, VALUE str)
|
|||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
|
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
|
||||||
|
RB_GC_GUARD(str);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user