lib/hexapdf/encryption/security_handler.rb in hexapdf-0.12.3 vs lib/hexapdf/encryption/security_handler.rb in hexapdf-0.13.0

- old
+ new

@@ -70,9 +70,10 @@ # Ensures that the encryption dictionary's content is valid. def perform_validation super unless [1, 2, 4, 5].include?(value[:V]) yield("Value of /V is not one of 1, 2, 4 or 5", false) + return end if value[:V] == 2 && (!key?(:Length) || value[:Length] < 40 || value[:Length] > 128 || value[:Length] % 8 != 0) yield("Invalid value for /Length field when /V is 2", false) end