net-imap 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30f6313663bc3f6e896e6166ad97a16296b52e59f9f2ef93f5b6ceb8a3031caa
4
- data.tar.gz: e916c89df8b3d7bbf7c310c0299a6b7134caf71a0514091f4f87a171247750a2
3
+ metadata.gz: 1c0b89eb763616a2d446e7a145245fcc88906162cdb6e41e1f73b89ac54269fb
4
+ data.tar.gz: aa19c272ab1142f1ebec8d40a7f56eeb348286188c154b9a4cfcd0819a2d4b18
5
5
  SHA512:
6
- metadata.gz: f19ca9b2808b3d293b1a6ffef2c8b3287f1f69471c914bf775d51b3259d3dc837cee635d647c575dab70795b06b54c37214d2c51e9138a2093df5d3e20d5b478
7
- data.tar.gz: d6c5b5c78de3f328486d4e107f1d6c336bb13be4738ad0d1b4e3b7b9b6af89f1a7bc77d09a7a27bd9f61160f38f4a5dc6c3a1ec5ae3f9f33705d6c52188e41f5
6
+ metadata.gz: 93819c8a2aa93f8e5e5737626981fadef9038e31afdec124f70ff6e29b4c233877031d64f3e19486e2976a713da40bed3e8cdf5d5939e953fa3b9cd864915ede
7
+ data.tar.gz: f07545087c1d4c1faece211b902096782421fba4f5d81ceab07f8e4c5fed0f2e3918e4c4ba027231ab52038edf4b7dc3a0c4200bf0f1480addfa6042aaf7716e
@@ -7,6 +7,8 @@ module Net
7
7
 
8
8
  # Parses an \IMAP server response.
9
9
  class ResponseParser
10
+ MAX_UID_SET_SIZE = 10_000
11
+
10
12
  # :call-seq: Net::IMAP::ResponseParser.new -> Net::IMAP::ResponseParser
11
13
  def initialize
12
14
  @str = nil
@@ -1379,11 +1381,29 @@ module Net
1379
1381
  case token.symbol
1380
1382
  when T_NUMBER then [Integer(token.value)]
1381
1383
  when T_ATOM
1382
- token.value.split(",").flat_map {|range|
1383
- range = range.split(":").map {|uniqueid| Integer(uniqueid) }
1384
- range.size == 1 ? range : Range.new(range.min, range.max).to_a
1384
+ entries = uid_set__ranges(token.value)
1385
+ if (count = entries.sum(&:count)) > MAX_UID_SET_SIZE
1386
+ parse_error("uid-set is too large: %d > 10k", count)
1387
+ end
1388
+ entries.flat_map(&:to_a)
1389
+ end
1390
+ end
1391
+
1392
+ # returns an array of ranges
1393
+ def uid_set__ranges(uidset)
1394
+ entries = []
1395
+ uidset.split(",") do |entry|
1396
+ uids = entry.split(":", 2).map {|uid|
1397
+ unless uid =~ /\A[1-9][0-9]*\z/
1398
+ parse_error("invalid uid-set uid: %p", uid)
1399
+ end
1400
+ uid = Integer(uid)
1401
+ NumValidator.ensure_nz_number(uid)
1402
+ uid
1385
1403
  }
1404
+ entries << Range.new(*uids.minmax)
1386
1405
  end
1406
+ entries
1387
1407
  end
1388
1408
 
1389
1409
  def nil_atom
data/lib/net/imap.rb CHANGED
@@ -699,7 +699,7 @@ module Net
699
699
  # * {Character sets}[https://www.iana.org/assignments/character-sets/character-sets.xhtml]
700
700
  #
701
701
  class IMAP < Protocol
702
- VERSION = "0.3.7"
702
+ VERSION = "0.3.8"
703
703
 
704
704
  include MonitorMixin
705
705
  if defined?(OpenSSL::SSL)
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-imap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
8
  - nicholas a. evans
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2023-07-26 00:00:00.000000000 Z
11
+ date: 2025-02-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: net-protocol
@@ -115,7 +114,6 @@ licenses:
115
114
  metadata:
116
115
  homepage_uri: https://github.com/ruby/net-imap
117
116
  source_code_uri: https://github.com/ruby/net-imap
118
- post_install_message:
119
117
  rdoc_options: []
120
118
  require_paths:
121
119
  - lib
@@ -130,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
128
  - !ruby/object:Gem::Version
131
129
  version: '0'
132
130
  requirements: []
133
- rubygems_version: 3.4.10
134
- signing_key:
131
+ rubygems_version: 3.6.2
135
132
  specification_version: 4
136
133
  summary: Ruby client api for Internet Message Access Protocol
137
134
  test_files: []