mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/gdbm/gdbm.c (fgdbm_store): StringValue() may alter string
pointer. [ruby-dev:24783] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									aee1d3d56c
								
							
						
					
					
						commit
						fa52148571
					
				
					 5 changed files with 22 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -23,6 +23,11 @@ Fri Nov 12 14:08:01 2004  Hidetoshi NAGAI  <nagai@ai.kyutech.ac.jp>
 | 
			
		|||
 | 
			
		||||
	* ext/tk/lib/tk.rb: ditto
 | 
			
		||||
 | 
			
		||||
Fri Nov 12 00:31:05 2004  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* ext/gdbm/gdbm.c (fgdbm_store): StringValue() may alter string
 | 
			
		||||
	  pointer.  [ruby-dev:24783]
 | 
			
		||||
 | 
			
		||||
Thu Nov 11 17:36:12 2004  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* dir.c (rb_globi): also should call back via rb_glob_caller().
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -494,11 +494,11 @@ fdbm_store(obj, keystr, valstr)
 | 
			
		|||
 | 
			
		||||
    fdbm_modify(obj);
 | 
			
		||||
    keystr = rb_obj_as_string(keystr);
 | 
			
		||||
    valstr = rb_obj_as_string(valstr);
 | 
			
		||||
 | 
			
		||||
    key.dptr = RSTRING(keystr)->ptr;
 | 
			
		||||
    key.dsize = RSTRING(keystr)->len;
 | 
			
		||||
 | 
			
		||||
    valstr = rb_obj_as_string(valstr);
 | 
			
		||||
    val.dptr = RSTRING(valstr)->ptr;
 | 
			
		||||
    val.dsize = RSTRING(valstr)->len;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -598,10 +598,11 @@ fgdbm_store(obj, keystr, valstr)
 | 
			
		|||
 | 
			
		||||
    rb_gdbm_modify(obj);
 | 
			
		||||
    StringValue(keystr);
 | 
			
		||||
    StringValue(valstr);
 | 
			
		||||
 | 
			
		||||
    key.dptr = RSTRING(keystr)->ptr;
 | 
			
		||||
    key.dsize = RSTRING(keystr)->len;
 | 
			
		||||
 | 
			
		||||
    StringValue(valstr);
 | 
			
		||||
    val.dptr = RSTRING(valstr)->ptr;
 | 
			
		||||
    val.dsize = RSTRING(valstr)->len;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -477,11 +477,11 @@ fsdbm_store(obj, keystr, valstr)
 | 
			
		|||
 | 
			
		||||
    fdbm_modify(obj);
 | 
			
		||||
    StringValue(keystr);
 | 
			
		||||
    StringValue(valstr);
 | 
			
		||||
 | 
			
		||||
    key.dptr = RSTRING(keystr)->ptr;
 | 
			
		||||
    key.dsize = RSTRING(keystr)->len;
 | 
			
		||||
 | 
			
		||||
    StringValue(valstr);
 | 
			
		||||
    val.dptr = RSTRING(valstr)->ptr;
 | 
			
		||||
    val.dsize = RSTRING(valstr)->len;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								pack.c
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								pack.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -253,11 +253,11 @@ endian()
 | 
			
		|||
#undef ntohl
 | 
			
		||||
#undef htons
 | 
			
		||||
#undef htonl
 | 
			
		||||
#endif
 | 
			
		||||
#define ntohs(x) swaps(x)
 | 
			
		||||
#define ntohl(x) swapl(x)
 | 
			
		||||
#define htons(x) swaps(x)
 | 
			
		||||
#define htonl(x) swapl(x)
 | 
			
		||||
#endif
 | 
			
		||||
#define ntohf(x) swapf(x)
 | 
			
		||||
#define ntohd(x) swapd(x)
 | 
			
		||||
#define htonf(x) swapf(x)
 | 
			
		||||
| 
						 | 
				
			
			@ -732,7 +732,6 @@ pack_pack(ary, fmt)
 | 
			
		|||
	    break;
 | 
			
		||||
 | 
			
		||||
	  case 'l':		/* signed long */
 | 
			
		||||
	  case 'L':		/* unsigned long */
 | 
			
		||||
	    while (len-- > 0) {
 | 
			
		||||
		long l;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -741,6 +740,15 @@ pack_pack(ary, fmt)
 | 
			
		|||
		rb_str_buf_cat(res, OFF32(&l), NATINT_LEN(long,4));
 | 
			
		||||
	    }
 | 
			
		||||
	    break;
 | 
			
		||||
	  case 'L':		/* unsigned long */
 | 
			
		||||
	    while (len-- > 0) {
 | 
			
		||||
		long l;
 | 
			
		||||
 | 
			
		||||
		from = NEXTFROM;
 | 
			
		||||
		l = NUM2U32(from);
 | 
			
		||||
		rb_str_buf_cat(res, OFF32(&l), NATINT_LEN(long,4));
 | 
			
		||||
	    }
 | 
			
		||||
	    break;
 | 
			
		||||
 | 
			
		||||
	  case 'q':		/* signed quad (64bit) int */
 | 
			
		||||
	  case 'Q':		/* unsigned quad (64bit) int */
 | 
			
		||||
| 
						 | 
				
			
			@ -769,7 +777,7 @@ pack_pack(ary, fmt)
 | 
			
		|||
		unsigned long l;
 | 
			
		||||
 | 
			
		||||
		from = NEXTFROM;
 | 
			
		||||
		l = NUM2I32(from);
 | 
			
		||||
		l = NUM2U32(from);
 | 
			
		||||
		l = NATINT_HTONL(l);
 | 
			
		||||
		rb_str_buf_cat(res, OFF32(&l), NATINT_LEN(long,4));
 | 
			
		||||
	    }
 | 
			
		||||
| 
						 | 
				
			
			@ -791,7 +799,7 @@ pack_pack(ary, fmt)
 | 
			
		|||
		unsigned long l;
 | 
			
		||||
 | 
			
		||||
		from = NEXTFROM;
 | 
			
		||||
		l = NUM2I32(from);
 | 
			
		||||
		l = NUM2U32(from);
 | 
			
		||||
		l = NATINT_HTOVL(l);
 | 
			
		||||
		rb_str_buf_cat(res, OFF32(&l), NATINT_LEN(long,4));
 | 
			
		||||
	    }
 | 
			
		||||
| 
						 | 
				
			
			@ -904,7 +912,7 @@ pack_pack(ary, fmt)
 | 
			
		|||
 | 
			
		||||
		from = NEXTFROM;
 | 
			
		||||
		from = rb_to_int(from);
 | 
			
		||||
		l = NUM2INT(from);
 | 
			
		||||
		l = NUM2UINT(from);
 | 
			
		||||
		if (l < 0) {
 | 
			
		||||
		    rb_raise(rb_eRangeError, "pack(U): value out of range");
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue