mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	 6111a9f9d0
			
		
	
	
		6111a9f9d0
		
	
	
	
	
		
			
			Reference used to be clever and stored the index of a ref in 18 bits and the generation in 14 bits, so that both fit into a single u32. However: - It set MAX_REF_INDEX incorrectly (the max value of an 18-bit number is `(1 << 18) - 1`, not `(1 << 19) - 1` - pdf_reference_1-7.pdf has 349223 objects, and that's larger than `(1 << 18) - 1` (which is 262143) Since a Reference is stored in Value which is a Variant that also stores a pointer, the size of Value is already 64-bit. So just don't be clever here. Makes pdf_reference_1-7.pdf get a bit further during decryption.
		
			
				
	
	
		
			37 lines
		
	
	
	
		
			676 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
	
		
			676 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
 | |
|  * Copyright (c) 2021, Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Types.h>
 | |
| 
 | |
| namespace PDF {
 | |
| 
 | |
| class Reference {
 | |
| public:
 | |
|     Reference(u32 index, u32 generation_index)
 | |
|         : m_ref_index(index)
 | |
|         , m_generation_index(generation_index)
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     [[nodiscard]] ALWAYS_INLINE u32 as_ref_index() const
 | |
|     {
 | |
|         return m_ref_index;
 | |
|     }
 | |
| 
 | |
|     [[nodiscard]] ALWAYS_INLINE u32 as_ref_generation_index() const
 | |
|     {
 | |
|         return m_generation_index;
 | |
|     }
 | |
| 
 | |
| private:
 | |
|     u32 m_ref_index;
 | |
|     u32 m_generation_index;
 | |
| };
 | |
| 
 | |
| }
 |