mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 19:52:29 +00:00 
			
		
		
		
	fix issue #57: undefined behavior in bit_vector.h
This commit is contained in:
		
							parent
							
								
									eae4d4e0df
								
							
						
					
					
						commit
						6645358fed
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -75,8 +75,11 @@ public: | |||
|     bit_vector(bit_vector const & source): | ||||
|         m_num_bits(source.m_num_bits), | ||||
|         m_capacity(source.m_capacity), | ||||
|         m_data(alloc_svect(unsigned, source.m_capacity)) { | ||||
|         memcpy(m_data, source.m_data, source.m_capacity * sizeof(unsigned)); | ||||
|         m_data(0) { | ||||
|         if (source.m_data) { | ||||
|             m_data = alloc_svect(unsigned, m_capacity); | ||||
|             memcpy(m_data, source.m_data, m_capacity * sizeof(unsigned)); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     bit_vector(unsigned const * source, int num_bits): | ||||
|  | @ -183,6 +186,9 @@ public: | |||
|     bool operator!=(bit_vector const & other) const { return !operator==(other); } | ||||
| 
 | ||||
|     bit_vector & operator=(bit_vector const & source) { | ||||
|         if (!source.m_data) | ||||
|             return *this; | ||||
| 
 | ||||
|         m_num_bits = source.m_num_bits; | ||||
|         if (m_capacity < source.m_capacity) { | ||||
|             dealloc_svect(m_data); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue