File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,31 @@ describe LavinMQ::AMQP::DurableQueue do
164
164
end
165
165
end
166
166
end
167
+
168
+ # ArithmeticOverflow error when routing key length = 255
169
+ # https://github.com/cloudamqp/lavinmq/issues/1093
170
+ it " should handle routing key length = 255" do
171
+ rk = " a" * 255
172
+ with_amqp_server do |s |
173
+ vhost = s.vhosts.create(" test_vhost" )
174
+ with_channel(s, vhost: vhost.name) do |ch |
175
+ q = ch.queue(rk, durable: true )
176
+ queue = vhost.queues[rk].as(LavinMQ ::AMQP ::DurableQueue )
177
+ q.publish_confirm " a"
178
+ store = LavinMQ ::Queue ::MessageStore .new(queue.@msg_store .@queue_data_dir , nil )
179
+
180
+ if env = store.shift?
181
+ if msg = env.message
182
+ msg.routing_key.should eq rk
183
+ else
184
+ fail " no message"
185
+ end
186
+ else
187
+ fail " no message"
188
+ end
189
+ end
190
+ end
191
+ end
167
192
end
168
193
169
194
describe LavinMQ ::VHost do
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ module LavinMQ
38
38
def self.skip (io, format = IO ::ByteFormat ::SystemEndian ) : UInt64
39
39
skipped = 0 _u64
40
40
skipped += io.skip(sizeof(UInt64 )) # ts
41
- skipped += io.skip(io.read_byte || raise IO ::EOFError .new) + 1 # ex
42
- skipped += io.skip(io.read_byte || raise IO ::EOFError .new) + 1 # rk
41
+ skipped += 1 + io.skip(io.read_byte || raise IO ::EOFError .new) # ex
42
+ skipped += 1 + io.skip(io.read_byte || raise IO ::EOFError .new) # rk
43
43
skipped += AMQ ::Protocol ::Properties .skip(io, format)
44
44
skipped += io.skip(UInt64 .from_io io, format) + sizeof(UInt64 )
45
45
skipped
You can’t perform that action at this time.
0 commit comments