File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,27 @@ def test_custom_select_date
58
58
assert_equal my_date , sample_date
59
59
end
60
60
61
+ # @override
62
+ def test_big_decimal
63
+ test_value = BigDecimal ( '9876543210_9876543210_9876543210.0' )
64
+
65
+ conn = DbType . connection
66
+
67
+ if conn . prepared_statements?
68
+ db_type = DbType . create! ( big_decimal : test_value )
69
+ db_type = DbType . find ( db_type . id )
70
+ assert_kind_of Integer , db_type . big_decimal
71
+ assert_equal test_value , db_type . big_decimal
72
+ else
73
+ # it seems the patch applies when prepared statements is disabled
74
+ # https://discuss.rubyonrails.org/t/cve-2022-44566-possible-denial-of-service-vulnerability-in-activerecords-postgresql-adapter/82119
75
+ # https://github.com/rails/rails/commit/4f44aa9d514e701ada92b5cf08beccf566eeaebf
76
+ assert_raise ActiveRecord ::ConnectionAdapters ::PostgreSQL ::Quoting ::IntegerOutOf64BitRange do
77
+ DbType . create! ( big_decimal : test_value )
78
+ end
79
+ end
80
+ end
81
+
61
82
def test_encoding
62
83
assert_not_nil connection . encoding
63
84
end
You can’t perform that action at this time.
0 commit comments