grpc 1.45.0 → 1.46.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (515) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +36 -29
  3. data/include/grpc/impl/codegen/grpc_types.h +7 -13
  4. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +309 -0
  5. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +122 -0
  6. data/src/core/ext/filters/{client_idle → channel_idle}/idle_filter_state.cc +1 -1
  7. data/src/core/ext/filters/{client_idle → channel_idle}/idle_filter_state.h +3 -3
  8. data/src/core/ext/filters/client_channel/client_channel.cc +163 -96
  9. data/src/core/ext/filters/client_channel/client_channel.h +2 -0
  10. data/src/core/ext/filters/client_channel/health/health_check_client.cc +124 -581
  11. data/src/core/ext/filters/client_channel/health/health_check_client.h +24 -160
  12. data/src/core/ext/filters/client_channel/http_proxy.cc +88 -110
  13. data/src/core/ext/filters/client_channel/http_proxy.h +17 -0
  14. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +182 -142
  15. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -6
  16. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -10
  17. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -58
  18. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +51 -48
  19. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +14 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +229 -284
  21. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +92 -257
  22. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +51 -221
  23. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +201 -0
  24. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +106 -0
  25. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +102 -55
  26. data/src/core/ext/filters/client_channel/retry_filter.cc +18 -3
  27. data/src/core/ext/filters/client_channel/subchannel.cc +5 -5
  28. data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +544 -0
  29. data/src/core/ext/filters/client_channel/subchannel_stream_client.h +214 -0
  30. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +127 -367
  31. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +24 -1
  32. data/src/core/ext/filters/http/client/http_client_filter.cc +78 -458
  33. data/src/core/ext/filters/http/client/http_client_filter.h +21 -4
  34. data/src/core/ext/filters/http/client_authority_filter.cc +17 -22
  35. data/src/core/ext/filters/http/client_authority_filter.h +6 -5
  36. data/src/core/ext/filters/http/http_filters_plugin.cc +9 -6
  37. data/src/core/ext/filters/http/server/http_server_filter.cc +2 -116
  38. data/src/core/ext/filters/server_config_selector/server_config_selector.cc +2 -8
  39. data/src/core/ext/filters/server_config_selector/server_config_selector.h +2 -2
  40. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +73 -201
  41. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -1
  42. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +5 -4
  43. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +139 -28
  44. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -0
  45. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -6
  46. data/src/core/ext/transport/chttp2/transport/internal.h +4 -2
  47. data/src/core/ext/transport/chttp2/transport/parsing.cc +8 -0
  48. data/src/core/ext/transport/chttp2/transport/writing.cc +24 -13
  49. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +27 -24
  50. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +143 -63
  51. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +37 -35
  52. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +177 -77
  53. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +115 -111
  54. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +547 -207
  55. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +5 -5
  56. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +26 -13
  57. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -5
  58. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +23 -9
  59. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -7
  60. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +18 -0
  61. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -4
  62. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +13 -4
  63. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -4
  64. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +9 -0
  65. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +49 -46
  66. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +217 -78
  67. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -3
  68. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +10 -2
  69. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +12 -12
  70. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +40 -8
  71. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +5 -5
  72. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +20 -2
  73. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +55 -55
  74. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +289 -110
  75. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +133 -125
  76. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +656 -267
  77. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +24 -18
  78. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +96 -23
  79. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +185 -173
  80. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +860 -309
  81. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -3
  82. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +10 -2
  83. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +44 -24
  84. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +165 -40
  85. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +72 -63
  86. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +433 -174
  87. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +33 -31
  88. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +154 -52
  89. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +5 -4
  90. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +14 -4
  91. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +89 -89
  92. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +460 -166
  93. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +76 -33
  94. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +379 -69
  95. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -2
  96. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +14 -6
  97. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +5 -25
  98. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +10 -91
  99. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +5 -5
  100. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +26 -13
  101. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +70 -68
  102. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +369 -131
  103. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +94 -65
  104. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +447 -161
  105. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -4
  106. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +27 -11
  107. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +104 -85
  108. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +378 -113
  109. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +2 -2
  110. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +3 -0
  111. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +6 -6
  112. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +30 -13
  113. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +7 -7
  114. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +43 -16
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +8 -8
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +58 -24
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +4 -4
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +14 -4
  119. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +18 -18
  120. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +100 -43
  121. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +31 -30
  122. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +171 -71
  123. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +32 -32
  124. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +196 -95
  125. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -2
  126. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +7 -2
  127. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +53 -46
  128. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +284 -129
  129. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +56 -50
  130. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +337 -146
  131. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +13 -11
  132. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +49 -14
  133. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -4
  134. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +14 -4
  135. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +5 -5
  136. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +20 -4
  137. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +33 -32
  138. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +205 -86
  139. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +34 -34
  140. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +175 -74
  141. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +56 -52
  142. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +370 -146
  143. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +27 -23
  144. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +173 -74
  145. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +362 -341
  146. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +2056 -845
  147. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +11 -11
  148. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +49 -16
  149. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +56 -50
  150. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +293 -111
  151. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +3 -3
  152. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +6 -0
  153. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -3
  154. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +10 -2
  155. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +5 -5
  156. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +26 -10
  157. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -5
  158. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +27 -12
  159. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +17 -16
  160. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +83 -36
  161. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -2
  162. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +7 -2
  163. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +8 -8
  164. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +46 -17
  165. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +9 -9
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +38 -12
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +7 -7
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +30 -10
  169. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -2
  170. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +10 -6
  171. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +15 -15
  172. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +71 -28
  173. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +25 -25
  174. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +149 -65
  175. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +8 -7
  176. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +30 -12
  177. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +9 -9
  178. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +42 -15
  179. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +173 -144
  180. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +898 -323
  181. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +51 -45
  182. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +261 -116
  183. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +13 -13
  184. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +70 -25
  185. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +80 -55
  186. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +410 -124
  187. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +5 -5
  188. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +23 -9
  189. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -1
  190. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +44 -44
  191. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +261 -122
  192. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +8 -8
  193. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +47 -21
  194. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +32 -32
  195. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +175 -66
  196. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -4
  197. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +17 -6
  198. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +8 -8
  199. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +38 -17
  200. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +8 -8
  201. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +12 -0
  202. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +7 -7
  203. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +43 -18
  204. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -3
  205. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +20 -9
  206. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -3
  207. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +24 -9
  208. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -2
  209. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +14 -6
  210. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +8 -8
  211. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +40 -16
  212. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +9 -9
  213. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +70 -25
  214. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +5 -5
  215. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +37 -18
  216. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +12 -12
  217. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +81 -30
  218. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +16 -16
  219. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +76 -30
  220. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +20 -20
  221. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +90 -30
  222. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +7 -7
  223. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +28 -10
  224. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -2
  225. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +3 -0
  226. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +5 -5
  227. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +13 -4
  228. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +9 -9
  229. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +18 -0
  230. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -4
  231. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +9 -0
  232. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +5 -5
  233. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +17 -4
  234. data/src/core/ext/upb-generated/google/api/annotations.upb.c +3 -3
  235. data/src/core/ext/upb-generated/google/api/annotations.upb.h +17 -2
  236. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +70 -66
  237. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +410 -162
  238. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +80 -74
  239. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +440 -158
  240. data/src/core/ext/upb-generated/google/api/http.upb.c +17 -17
  241. data/src/core/ext/upb-generated/google/api/http.upb.h +116 -43
  242. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -4
  243. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +19 -7
  244. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -3
  245. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +6 -0
  246. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +163 -162
  247. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1157 -435
  248. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -3
  249. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +10 -4
  250. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
  251. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +15 -15
  252. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +108 -40
  253. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -3
  254. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +10 -4
  255. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +18 -18
  256. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -0
  257. data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -4
  258. data/src/core/ext/upb-generated/google/rpc/status.upb.h +19 -7
  259. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +15 -15
  260. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +65 -22
  261. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +12 -12
  262. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +49 -12
  263. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +69 -65
  264. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +364 -149
  265. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +8 -7
  266. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +20 -4
  267. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +4 -4
  268. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -0
  269. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +31 -31
  270. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +150 -58
  271. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +11 -11
  272. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +51 -18
  273. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +175 -0
  274. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +764 -0
  275. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +22 -22
  276. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +97 -10
  277. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +6 -6
  278. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +23 -2
  279. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +3 -3
  280. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +10 -2
  281. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +6 -6
  282. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +27 -6
  283. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +5 -5
  284. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +20 -2
  285. data/src/core/ext/upb-generated/validate/validate.upb.c +261 -250
  286. data/src/core/ext/upb-generated/validate/validate.upb.h +1836 -663
  287. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +22 -22
  288. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +97 -10
  289. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +6 -6
  290. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +23 -2
  291. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +3 -3
  292. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +10 -2
  293. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +18 -18
  294. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +70 -10
  295. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +5 -5
  296. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +20 -2
  297. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -2
  298. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +3 -0
  299. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +8 -8
  300. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +38 -12
  301. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +5 -5
  302. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +27 -10
  303. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -3
  304. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +10 -2
  305. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +5 -5
  306. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +21 -8
  307. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +10 -10
  308. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +71 -30
  309. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -5
  310. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +16 -2
  311. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +12 -12
  312. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +69 -26
  313. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +43 -39
  314. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +255 -103
  315. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +4 -4
  316. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +19 -8
  317. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +9 -9
  318. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +70 -25
  319. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -3
  320. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +10 -2
  321. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +50 -46
  322. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +195 -185
  323. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +16 -12
  324. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +129 -94
  325. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +10 -0
  326. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +18 -33
  327. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +0 -5
  328. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +163 -155
  329. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +5 -0
  330. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +141 -138
  331. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +26 -20
  332. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +738 -730
  333. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +271 -251
  334. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  335. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +207 -193
  336. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +5 -0
  337. data/src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls_config.upbdefs.c +99 -0
  338. data/src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls_config.upbdefs.h +75 -0
  339. data/src/core/ext/xds/certificate_provider_store.cc +8 -0
  340. data/src/core/ext/xds/certificate_provider_store.h +9 -0
  341. data/src/core/ext/xds/xds_api.cc +20 -0
  342. data/src/core/ext/xds/xds_bootstrap.cc +2 -2
  343. data/src/core/ext/xds/xds_bootstrap.h +2 -0
  344. data/src/core/ext/xds/xds_certificate_provider.cc +2 -0
  345. data/src/core/ext/xds/xds_certificate_provider.h +8 -0
  346. data/src/core/ext/xds/xds_client.cc +87 -95
  347. data/src/core/ext/xds/xds_client.h +13 -5
  348. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +142 -0
  349. data/src/core/ext/xds/xds_cluster_specifier_plugin.h +79 -0
  350. data/src/core/ext/xds/xds_common_types.cc +9 -9
  351. data/src/core/ext/xds/xds_common_types.h +3 -3
  352. data/src/core/ext/xds/xds_endpoint.cc +12 -5
  353. data/src/core/ext/xds/xds_http_fault_filter.cc +1 -1
  354. data/src/core/ext/xds/xds_listener.cc +1 -1
  355. data/src/core/ext/xds/xds_route_config.cc +162 -25
  356. data/src/core/ext/xds/xds_route_config.h +13 -10
  357. data/src/core/ext/xds/xds_server_config_fetcher.cc +17 -22
  358. data/src/core/lib/avl/avl.h +68 -5
  359. data/src/core/lib/channel/call_tracer.h +4 -1
  360. data/src/core/lib/channel/channel_args.cc +138 -59
  361. data/src/core/lib/channel/channel_args.h +210 -9
  362. data/src/core/lib/channel/channel_args_preconditioning.cc +3 -9
  363. data/src/core/lib/channel/channel_args_preconditioning.h +1 -2
  364. data/src/core/lib/channel/channel_stack.h +2 -5
  365. data/src/core/lib/channel/channel_stack_builder.cc +0 -65
  366. data/src/core/lib/channel/channel_stack_builder.h +27 -6
  367. data/src/core/lib/channel/channel_stack_builder_impl.cc +102 -0
  368. data/src/core/lib/channel/channel_stack_builder_impl.h +48 -0
  369. data/src/core/lib/channel/connected_channel.h +1 -0
  370. data/src/core/lib/channel/promise_based_filter.cc +495 -162
  371. data/src/core/lib/channel/promise_based_filter.h +55 -41
  372. data/src/core/lib/compression/compression_internal.cc +1 -7
  373. data/src/core/lib/debug/stats_data.cc +2 -6
  374. data/src/core/lib/debug/stats_data.h +18 -21
  375. data/src/core/lib/gpr/tls.h +1 -0
  376. data/src/core/lib/gprpp/bitset.h +12 -0
  377. data/src/core/lib/gprpp/cpp_impl_of.h +4 -0
  378. data/src/core/lib/gprpp/match.h +73 -0
  379. data/src/core/lib/gprpp/overload.h +59 -0
  380. data/src/core/lib/gprpp/ref_counted.h +2 -0
  381. data/src/core/lib/gprpp/single_set_ptr.h +87 -0
  382. data/src/core/lib/gprpp/status_helper.cc +18 -2
  383. data/src/core/lib/gprpp/time.cc +12 -0
  384. data/src/core/lib/gprpp/time.h +1 -1
  385. data/src/core/lib/http/format_request.cc +1 -2
  386. data/src/core/lib/http/httpcli_security_connector.cc +5 -5
  387. data/src/core/lib/http/parser.cc +80 -9
  388. data/src/core/lib/http/parser.h +14 -1
  389. data/src/core/lib/iomgr/ev_posix.cc +6 -7
  390. data/src/core/lib/iomgr/fork_posix.cc +1 -1
  391. data/src/core/lib/iomgr/port.h +0 -2
  392. data/src/core/lib/iomgr/tcp_client_posix.cc +2 -2
  393. data/src/core/lib/iomgr/tcp_posix.cc +93 -35
  394. data/src/core/lib/iomgr/tcp_server_posix.cc +26 -17
  395. data/src/core/lib/json/json_util.h +3 -3
  396. data/src/core/lib/promise/call_push_pull.h +144 -0
  397. data/src/core/lib/promise/detail/status.h +2 -1
  398. data/src/core/lib/promise/intra_activity_waiter.h +49 -0
  399. data/src/core/lib/promise/latch.h +104 -0
  400. data/src/core/lib/resource_quota/api.cc +5 -30
  401. data/src/core/lib/resource_quota/api.h +1 -1
  402. data/src/core/lib/resource_quota/resource_quota.h +8 -0
  403. data/src/core/lib/security/authorization/authorization_policy_provider.h +7 -0
  404. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +9 -12
  405. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +5 -6
  406. data/src/core/lib/security/context/security_context.h +8 -1
  407. data/src/core/lib/security/credentials/alts/alts_credentials.cc +6 -5
  408. data/src/core/lib/security/credentials/alts/alts_credentials.h +4 -0
  409. data/src/core/lib/security/credentials/call_creds_util.cc +3 -3
  410. data/src/core/lib/security/credentials/call_creds_util.h +2 -2
  411. data/src/core/lib/security/credentials/composite/composite_credentials.cc +15 -10
  412. data/src/core/lib/security/credentials/composite/composite_credentials.h +9 -8
  413. data/src/core/lib/security/credentials/credentials.h +16 -33
  414. data/src/core/lib/security/credentials/fake/fake_credentials.cc +8 -12
  415. data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -5
  416. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +4 -0
  417. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
  418. data/src/core/lib/security/credentials/iam/iam_credentials.cc +5 -4
  419. data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -2
  420. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +22 -29
  421. data/src/core/lib/security/credentials/insecure/insecure_credentials.h +57 -0
  422. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -3
  423. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +6 -2
  424. data/src/core/lib/security/credentials/local/local_credentials.cc +6 -6
  425. data/src/core/lib/security/credentials/local/local_credentials.h +4 -0
  426. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +17 -9
  427. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +14 -6
  428. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +8 -6
  429. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +8 -6
  430. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +6 -4
  431. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +8 -0
  432. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +49 -0
  433. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +8 -0
  434. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +42 -3
  435. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +66 -95
  436. data/src/core/lib/security/credentials/tls/tls_credentials.cc +9 -6
  437. data/src/core/lib/security/credentials/tls/tls_credentials.h +5 -5
  438. data/src/core/lib/security/credentials/xds/xds_credentials.cc +48 -50
  439. data/src/core/lib/security/credentials/xds/xds_credentials.h +31 -5
  440. data/src/core/lib/security/security_connector/local/local_security_connector.cc +2 -2
  441. data/src/core/lib/security/security_connector/security_connector.h +9 -0
  442. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -2
  443. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +4 -2
  444. data/src/core/lib/security/transport/auth_filters.h +7 -7
  445. data/src/core/lib/security/transport/client_auth_filter.cc +28 -20
  446. data/src/core/lib/security/transport/secure_endpoint.cc +198 -129
  447. data/src/core/lib/security/transport/secure_endpoint.h +1 -1
  448. data/src/core/lib/security/transport/security_handshaker.cc +6 -4
  449. data/src/core/lib/surface/call.cc +1023 -903
  450. data/src/core/lib/surface/call.h +0 -14
  451. data/src/core/lib/surface/channel.cc +4 -3
  452. data/src/core/lib/surface/channel_init.cc +2 -3
  453. data/src/core/lib/surface/channel_init.h +2 -6
  454. data/src/core/lib/surface/init.cc +1 -1
  455. data/src/core/lib/surface/server.cc +3 -14
  456. data/src/core/lib/surface/server.h +1 -2
  457. data/src/core/lib/surface/version.cc +2 -2
  458. data/src/core/lib/transport/byte_stream.cc +2 -0
  459. data/src/core/lib/transport/metadata_batch.h +12 -8
  460. data/src/core/lib/transport/transport.h +20 -5
  461. data/src/core/lib/transport/transport_impl.h +4 -3
  462. data/src/core/plugin_registry/grpc_plugin_registry.cc +2 -4
  463. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
  464. data/src/core/tsi/ssl_transport_security.cc +75 -38
  465. data/src/core/tsi/ssl_transport_security.h +8 -2
  466. data/src/core/tsi/transport_security_interface.h +2 -0
  467. data/src/ruby/ext/grpc/extconf.rb +1 -1
  468. data/src/ruby/lib/grpc/generic/active_call.rb +7 -1
  469. data/src/ruby/lib/grpc/grpc.rb +1 -1
  470. data/src/ruby/lib/grpc/version.rb +1 -1
  471. data/src/ruby/pb/generate_proto_ruby.sh +1 -0
  472. data/src/ruby/pb/test/client.rb +769 -0
  473. data/src/ruby/pb/test/server.rb +252 -0
  474. data/src/ruby/pb/test/xds_client.rb +415 -0
  475. data/third_party/upb/third_party/utf8_range/utf8_range.h +1 -1
  476. data/third_party/upb/upb/decode.c +32 -16
  477. data/third_party/upb/upb/def.c +118 -55
  478. data/third_party/upb/upb/def.h +12 -3
  479. data/third_party/upb/upb/encode.c +14 -8
  480. data/third_party/upb/upb/json_encode.c +776 -0
  481. data/third_party/upb/upb/json_encode.h +62 -0
  482. data/third_party/upb/upb/msg.c +5 -7
  483. data/third_party/upb/upb/msg.h +1 -2
  484. data/third_party/upb/upb/msg_internal.h +49 -36
  485. data/third_party/upb/upb/port_def.inc +8 -0
  486. data/third_party/upb/upb/port_undef.inc +1 -0
  487. data/third_party/upb/upb/table.c +10 -6
  488. data/third_party/upb/upb/table_internal.h +2 -0
  489. data/third_party/upb/upb/upb.h +41 -11
  490. data/third_party/zlib/crc32.c +966 -292
  491. data/third_party/zlib/crc32.h +9441 -436
  492. data/third_party/zlib/deflate.c +78 -30
  493. data/third_party/zlib/deflate.h +12 -15
  494. data/third_party/zlib/gzguts.h +3 -2
  495. data/third_party/zlib/gzlib.c +5 -3
  496. data/third_party/zlib/gzread.c +5 -7
  497. data/third_party/zlib/gzwrite.c +25 -13
  498. data/third_party/zlib/infback.c +2 -1
  499. data/third_party/zlib/inffast.c +14 -14
  500. data/third_party/zlib/inflate.c +39 -8
  501. data/third_party/zlib/inflate.h +3 -2
  502. data/third_party/zlib/inftrees.c +3 -3
  503. data/third_party/zlib/trees.c +27 -48
  504. data/third_party/zlib/zlib.h +123 -100
  505. data/third_party/zlib/zutil.c +2 -2
  506. data/third_party/zlib/zutil.h +12 -9
  507. metadata +66 -45
  508. data/src/core/ext/filters/client_idle/client_idle_filter.cc +0 -201
  509. data/src/core/ext/filters/max_age/max_age_filter.cc +0 -566
  510. data/src/core/ext/filters/max_age/max_age_filter.h +0 -26
  511. data/src/core/lib/iomgr/ev_epollex_linux.cc +0 -1657
  512. data/src/core/lib/iomgr/ev_epollex_linux.h +0 -30
  513. data/src/core/lib/iomgr/is_epollexclusive_available.cc +0 -119
  514. data/src/core/lib/iomgr/is_epollexclusive_available.h +0 -36
  515. data/src/core/lib/iomgr/sys_epoll_wrapper.h +0 -30
@@ -1,5 +1,5 @@
1
1
  /* deflate.c -- compress data using the deflation algorithm
2
- * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
2
+ * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -52,7 +52,7 @@
52
52
  #include "deflate.h"
53
53
 
54
54
  const char deflate_copyright[] =
55
- " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
55
+ " deflate 1.2.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
56
56
  /*
57
57
  If you use the zlib library in a product, an acknowledgment is welcome
58
58
  in the documentation of your product. If for some reason you cannot
@@ -190,8 +190,11 @@ local const config configuration_table[10] = {
190
190
  * prev[] will be initialized on the fly.
191
191
  */
192
192
  #define CLEAR_HASH(s) \
193
- s->head[s->hash_size-1] = NIL; \
194
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
193
+ do { \
194
+ s->head[s->hash_size-1] = NIL; \
195
+ zmemzero((Bytef *)s->head, \
196
+ (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
197
+ } while (0)
195
198
 
196
199
  /* ===========================================================================
197
200
  * Slide the hash table when sliding the window down (could be avoided with 32
@@ -252,11 +255,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
252
255
  int wrap = 1;
253
256
  static const char my_version[] = ZLIB_VERSION;
254
257
 
255
- ushf *overlay;
256
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
257
- * output size for (length,distance) codes is <= 24 bits.
258
- */
259
-
260
258
  if (version == Z_NULL || version[0] != my_version[0] ||
261
259
  stream_size != sizeof(z_stream)) {
262
260
  return Z_VERSION_ERROR;
@@ -326,9 +324,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
326
324
 
327
325
  s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
328
326
 
329
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
330
- s->pending_buf = (uchf *) overlay;
331
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
327
+ /* We overlay pending_buf and sym_buf. This works since the average size
328
+ * for length/distance pairs over any compressed block is assured to be 31
329
+ * bits or less.
330
+ *
331
+ * Analysis: The longest fixed codes are a length code of 8 bits plus 5
332
+ * extra bits, for lengths 131 to 257. The longest fixed distance codes are
333
+ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
334
+ * possible fixed-codes length/distance pair is then 31 bits total.
335
+ *
336
+ * sym_buf starts one-fourth of the way into pending_buf. So there are
337
+ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
338
+ * in sym_buf is three bytes -- two for the distance and one for the
339
+ * literal/length. As each symbol is consumed, the pointer to the next
340
+ * sym_buf value to read moves forward three bytes. From that symbol, up to
341
+ * 31 bits are written to pending_buf. The closest the written pending_buf
342
+ * bits gets to the next sym_buf symbol to read is just before the last
343
+ * code is written. At that time, 31*(n-2) bits have been written, just
344
+ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
345
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
346
+ * symbols are written.) The closest the writing gets to what is unread is
347
+ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
348
+ * can range from 128 to 32768.
349
+ *
350
+ * Therefore, at a minimum, there are 142 bits of space between what is
351
+ * written and what is read in the overlain buffers, so the symbols cannot
352
+ * be overwritten by the compressed data. That space is actually 139 bits,
353
+ * due to the three-bit fixed-code block header.
354
+ *
355
+ * That covers the case where either Z_FIXED is specified, forcing fixed
356
+ * codes, or when the use of fixed codes is chosen, because that choice
357
+ * results in a smaller compressed block than dynamic codes. That latter
358
+ * condition then assures that the above analysis also covers all dynamic
359
+ * blocks. A dynamic-code block will only be chosen to be emitted if it has
360
+ * fewer bits than a fixed-code block would for the same set of symbols.
361
+ * Therefore its average symbol length is assured to be less than 31. So
362
+ * the compressed data for a dynamic block also cannot overwrite the
363
+ * symbols from which it is being constructed.
364
+ */
365
+
366
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
367
+ s->pending_buf_size = (ulg)s->lit_bufsize * 4;
332
368
 
333
369
  if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
334
370
  s->pending_buf == Z_NULL) {
@@ -337,8 +373,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
337
373
  deflateEnd (strm);
338
374
  return Z_MEM_ERROR;
339
375
  }
340
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
341
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
376
+ s->sym_buf = s->pending_buf + s->lit_bufsize;
377
+ s->sym_end = (s->lit_bufsize - 1) * 3;
378
+ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
379
+ * on 16 bit machines and because stored blocks are restricted to
380
+ * 64K-1 bytes.
381
+ */
342
382
 
343
383
  s->level = level;
344
384
  s->strategy = strategy;
@@ -488,13 +528,13 @@ int ZEXPORT deflateResetKeep (strm)
488
528
  #ifdef GZIP
489
529
  s->wrap == 2 ? GZIP_STATE :
490
530
  #endif
491
- s->wrap ? INIT_STATE : BUSY_STATE;
531
+ INIT_STATE;
492
532
  strm->adler =
493
533
  #ifdef GZIP
494
534
  s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
495
535
  #endif
496
536
  adler32(0L, Z_NULL, 0);
497
- s->last_flush = Z_NO_FLUSH;
537
+ s->last_flush = -2;
498
538
 
499
539
  _tr_init(s);
500
540
 
@@ -549,7 +589,8 @@ int ZEXPORT deflatePrime (strm, bits, value)
549
589
 
550
590
  if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
551
591
  s = strm->state;
552
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
592
+ if (bits < 0 || bits > 16 ||
593
+ s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
553
594
  return Z_BUF_ERROR;
554
595
  do {
555
596
  put = Buf_size - s->bi_valid;
@@ -587,12 +628,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
587
628
  func = configuration_table[s->level].func;
588
629
 
589
630
  if ((strategy != s->strategy || func != configuration_table[level].func) &&
590
- s->high_water) {
631
+ s->last_flush != -2) {
591
632
  /* Flush the last buffer: */
592
633
  int err = deflate(strm, Z_BLOCK);
593
634
  if (err == Z_STREAM_ERROR)
594
635
  return err;
595
- if (strm->avail_out == 0)
636
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
596
637
  return Z_BUF_ERROR;
597
638
  }
598
639
  if (s->level != level) {
@@ -811,6 +852,8 @@ int ZEXPORT deflate (strm, flush)
811
852
  }
812
853
 
813
854
  /* Write the header */
855
+ if (s->status == INIT_STATE && s->wrap == 0)
856
+ s->status = BUSY_STATE;
814
857
  if (s->status == INIT_STATE) {
815
858
  /* zlib header */
816
859
  uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
@@ -1108,7 +1151,6 @@ int ZEXPORT deflateCopy (dest, source)
1108
1151
  #else
1109
1152
  deflate_state *ds;
1110
1153
  deflate_state *ss;
1111
- ushf *overlay;
1112
1154
 
1113
1155
 
1114
1156
  if (deflateStateCheck(source) || dest == Z_NULL) {
@@ -1128,8 +1170,7 @@ int ZEXPORT deflateCopy (dest, source)
1128
1170
  ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
1129
1171
  ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
1130
1172
  ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
1131
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
1132
- ds->pending_buf = (uchf *) overlay;
1173
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
1133
1174
 
1134
1175
  if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
1135
1176
  ds->pending_buf == Z_NULL) {
@@ -1143,8 +1184,7 @@ int ZEXPORT deflateCopy (dest, source)
1143
1184
  zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
1144
1185
 
1145
1186
  ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
1146
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
1147
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
1187
+ ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
1148
1188
 
1149
1189
  ds->l_desc.dyn_tree = ds->dyn_ltree;
1150
1190
  ds->d_desc.dyn_tree = ds->dyn_dtree;
@@ -1513,6 +1553,8 @@ local void fill_window(s)
1513
1553
  s->match_start -= wsize;
1514
1554
  s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
1515
1555
  s->block_start -= (long) wsize;
1556
+ if (s->insert > s->strstart)
1557
+ s->insert = s->strstart;
1516
1558
  slide_hash(s);
1517
1559
  more += wsize;
1518
1560
  }
@@ -1742,6 +1784,7 @@ local block_state deflate_stored(s, flush)
1742
1784
  s->matches = 2; /* clear hash */
1743
1785
  zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
1744
1786
  s->strstart = s->w_size;
1787
+ s->insert = s->strstart;
1745
1788
  }
1746
1789
  else {
1747
1790
  if (s->window_size - s->strstart <= used) {
@@ -1750,12 +1793,14 @@ local block_state deflate_stored(s, flush)
1750
1793
  zmemcpy(s->window, s->window + s->w_size, s->strstart);
1751
1794
  if (s->matches < 2)
1752
1795
  s->matches++; /* add a pending slide_hash() */
1796
+ if (s->insert > s->strstart)
1797
+ s->insert = s->strstart;
1753
1798
  }
1754
1799
  zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
1755
1800
  s->strstart += used;
1801
+ s->insert += MIN(used, s->w_size - s->insert);
1756
1802
  }
1757
1803
  s->block_start = s->strstart;
1758
- s->insert += MIN(used, s->w_size - s->insert);
1759
1804
  }
1760
1805
  if (s->high_water < s->strstart)
1761
1806
  s->high_water = s->strstart;
@@ -1770,7 +1815,7 @@ local block_state deflate_stored(s, flush)
1770
1815
  return block_done;
1771
1816
 
1772
1817
  /* Fill the window with any remaining input. */
1773
- have = s->window_size - s->strstart - 1;
1818
+ have = s->window_size - s->strstart;
1774
1819
  if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
1775
1820
  /* Slide the window down. */
1776
1821
  s->block_start -= s->w_size;
@@ -1779,12 +1824,15 @@ local block_state deflate_stored(s, flush)
1779
1824
  if (s->matches < 2)
1780
1825
  s->matches++; /* add a pending slide_hash() */
1781
1826
  have += s->w_size; /* more space now */
1827
+ if (s->insert > s->strstart)
1828
+ s->insert = s->strstart;
1782
1829
  }
1783
1830
  if (have > s->strm->avail_in)
1784
1831
  have = s->strm->avail_in;
1785
1832
  if (have) {
1786
1833
  read_buf(s->strm, s->window + s->strstart, have);
1787
1834
  s->strstart += have;
1835
+ s->insert += MIN(have, s->w_size - s->insert);
1788
1836
  }
1789
1837
  if (s->high_water < s->strstart)
1790
1838
  s->high_water = s->strstart;
@@ -1912,7 +1960,7 @@ local block_state deflate_fast(s, flush)
1912
1960
  FLUSH_BLOCK(s, 1);
1913
1961
  return finish_done;
1914
1962
  }
1915
- if (s->last_lit)
1963
+ if (s->sym_next)
1916
1964
  FLUSH_BLOCK(s, 0);
1917
1965
  return block_done;
1918
1966
  }
@@ -2043,7 +2091,7 @@ local block_state deflate_slow(s, flush)
2043
2091
  FLUSH_BLOCK(s, 1);
2044
2092
  return finish_done;
2045
2093
  }
2046
- if (s->last_lit)
2094
+ if (s->sym_next)
2047
2095
  FLUSH_BLOCK(s, 0);
2048
2096
  return block_done;
2049
2097
  }
@@ -2118,7 +2166,7 @@ local block_state deflate_rle(s, flush)
2118
2166
  FLUSH_BLOCK(s, 1);
2119
2167
  return finish_done;
2120
2168
  }
2121
- if (s->last_lit)
2169
+ if (s->sym_next)
2122
2170
  FLUSH_BLOCK(s, 0);
2123
2171
  return block_done;
2124
2172
  }
@@ -2157,7 +2205,7 @@ local block_state deflate_huff(s, flush)
2157
2205
  FLUSH_BLOCK(s, 1);
2158
2206
  return finish_done;
2159
2207
  }
2160
- if (s->last_lit)
2208
+ if (s->sym_next)
2161
2209
  FLUSH_BLOCK(s, 0);
2162
2210
  return block_done;
2163
2211
  }
@@ -1,5 +1,5 @@
1
1
  /* deflate.h -- internal compression state
2
- * Copyright (C) 1995-2016 Jean-loup Gailly
2
+ * Copyright (C) 1995-2018 Jean-loup Gailly
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -217,7 +217,7 @@ typedef struct internal_state {
217
217
  /* Depth of each subtree used as tie breaker for trees of equal frequency
218
218
  */
219
219
 
220
- uchf *l_buf; /* buffer for literals or lengths */
220
+ uchf *sym_buf; /* buffer for distances and literals/lengths */
221
221
 
222
222
  uInt lit_bufsize;
223
223
  /* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -239,13 +239,8 @@ typedef struct internal_state {
239
239
  * - I can't count above 4
240
240
  */
241
241
 
242
- uInt last_lit; /* running index in l_buf */
243
-
244
- ushf *d_buf;
245
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
246
- * the same number of elements. To use different lengths, an extra flag
247
- * array would be necessary.
248
- */
242
+ uInt sym_next; /* running index in sym_buf */
243
+ uInt sym_end; /* symbol table full when sym_next reaches this */
249
244
 
250
245
  ulg opt_len; /* bit length of current block with optimal trees */
251
246
  ulg static_len; /* bit length of current block with static trees */
@@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
325
320
 
326
321
  # define _tr_tally_lit(s, c, flush) \
327
322
  { uch cc = (c); \
328
- s->d_buf[s->last_lit] = 0; \
329
- s->l_buf[s->last_lit++] = cc; \
323
+ s->sym_buf[s->sym_next++] = 0; \
324
+ s->sym_buf[s->sym_next++] = 0; \
325
+ s->sym_buf[s->sym_next++] = cc; \
330
326
  s->dyn_ltree[cc].Freq++; \
331
- flush = (s->last_lit == s->lit_bufsize-1); \
327
+ flush = (s->sym_next == s->sym_end); \
332
328
  }
333
329
  # define _tr_tally_dist(s, distance, length, flush) \
334
330
  { uch len = (uch)(length); \
335
331
  ush dist = (ush)(distance); \
336
- s->d_buf[s->last_lit] = dist; \
337
- s->l_buf[s->last_lit++] = len; \
332
+ s->sym_buf[s->sym_next++] = dist; \
333
+ s->sym_buf[s->sym_next++] = dist >> 8; \
334
+ s->sym_buf[s->sym_next++] = len; \
338
335
  dist--; \
339
336
  s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
340
337
  s->dyn_dtree[d_code(dist)].Freq++; \
341
- flush = (s->last_lit == s->lit_bufsize-1); \
338
+ flush = (s->sym_next == s->sym_end); \
342
339
  }
343
340
  #else
344
341
  # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
@@ -1,5 +1,5 @@
1
1
  /* gzguts.h -- zlib internal header definitions for gz* operations
2
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
2
+ * Copyright (C) 2004-2019 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -39,7 +39,7 @@
39
39
  # include <io.h>
40
40
  #endif
41
41
 
42
- #if defined(_WIN32) || defined(__CYGWIN__)
42
+ #if defined(_WIN32)
43
43
  # define WIDECHAR
44
44
  #endif
45
45
 
@@ -190,6 +190,7 @@ typedef struct {
190
190
  /* just for writing */
191
191
  int level; /* compression level */
192
192
  int strategy; /* compression strategy */
193
+ int reset; /* true if a reset is pending after a Z_FINISH */
193
194
  /* seek request */
194
195
  z_off64_t skip; /* amount to skip (already rewound if backwards) */
195
196
  int seek; /* true if seek request pending */
@@ -1,11 +1,11 @@
1
1
  /* gzlib.c -- zlib functions common to reading and writing gzip files
2
- * Copyright (C) 2004-2017 Mark Adler
2
+ * Copyright (C) 2004-2019 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
6
6
  #include "gzguts.h"
7
7
 
8
- #if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
8
+ #if defined(_WIN32) && !defined(__BORLANDC__)
9
9
  # define LSEEK _lseeki64
10
10
  #else
11
11
  #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
@@ -81,6 +81,8 @@ local void gz_reset(state)
81
81
  state->past = 0; /* have not read past end yet */
82
82
  state->how = LOOK; /* look for gzip header */
83
83
  }
84
+ else /* for writing ... */
85
+ state->reset = 0; /* no deflateReset pending */
84
86
  state->seek = 0; /* no seek request pending */
85
87
  gz_error(state, Z_OK, NULL); /* clear error */
86
88
  state->x.pos = 0; /* no uncompressed data yet */
@@ -397,7 +399,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
397
399
  /* if within raw area while reading, just go there */
398
400
  if (state->mode == GZ_READ && state->how == COPY &&
399
401
  state->x.pos + offset >= 0) {
400
- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
402
+ ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
401
403
  if (ret == -1)
402
404
  return -1;
403
405
  state->x.have = 0;
@@ -1,5 +1,5 @@
1
1
  /* gzread.c -- zlib functions for reading gzip files
2
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
2
+ * Copyright (C) 2004-2017 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -314,9 +314,9 @@ local z_size_t gz_read(state, buf, len)
314
314
  got = 0;
315
315
  do {
316
316
  /* set n to the maximum amount of len that fits in an unsigned int */
317
- n = -1;
317
+ n = (unsigned)-1;
318
318
  if (n > len)
319
- n = len;
319
+ n = (unsigned)len;
320
320
 
321
321
  /* first just try copying data from the output buffer */
322
322
  if (state->x.have) {
@@ -397,7 +397,7 @@ int ZEXPORT gzread(file, buf, len)
397
397
  }
398
398
 
399
399
  /* read len or fewer bytes to buf */
400
- len = gz_read(state, buf, len);
400
+ len = (unsigned)gz_read(state, buf, len);
401
401
 
402
402
  /* check for an error */
403
403
  if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
@@ -447,7 +447,6 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
447
447
  int ZEXPORT gzgetc(file)
448
448
  gzFile file;
449
449
  {
450
- int ret;
451
450
  unsigned char buf[1];
452
451
  gz_statep state;
453
452
 
@@ -469,8 +468,7 @@ int ZEXPORT gzgetc(file)
469
468
  }
470
469
 
471
470
  /* nothing there -- try gz_read() */
472
- ret = gz_read(state, buf, 1);
473
- return ret < 1 ? -1 : buf[0];
471
+ return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
474
472
  }
475
473
 
476
474
  int ZEXPORT gzgetc_(file)
@@ -1,5 +1,5 @@
1
1
  /* gzwrite.c -- zlib functions for writing gzip files
2
- * Copyright (C) 2004-2017 Mark Adler
2
+ * Copyright (C) 2004-2019 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -97,6 +97,15 @@ local int gz_comp(state, flush)
97
97
  return 0;
98
98
  }
99
99
 
100
+ /* check for a pending reset */
101
+ if (state->reset) {
102
+ /* don't start a new gzip member unless there is data to write */
103
+ if (strm->avail_in == 0)
104
+ return 0;
105
+ deflateReset(strm);
106
+ state->reset = 0;
107
+ }
108
+
100
109
  /* run deflate() on provided input until it produces no more output */
101
110
  ret = Z_OK;
102
111
  do {
@@ -134,7 +143,7 @@ local int gz_comp(state, flush)
134
143
 
135
144
  /* if that completed a deflate stream, allow another to start */
136
145
  if (flush == Z_FINISH)
137
- deflateReset(strm);
146
+ state->reset = 1;
138
147
 
139
148
  /* all done, no errors */
140
149
  return 0;
@@ -209,7 +218,7 @@ local z_size_t gz_write(state, buf, len)
209
218
  state->in);
210
219
  copy = state->size - have;
211
220
  if (copy > len)
212
- copy = len;
221
+ copy = (unsigned)len;
213
222
  memcpy(state->in + have, buf, copy);
214
223
  state->strm.avail_in += copy;
215
224
  state->x.pos += copy;
@@ -229,7 +238,7 @@ local z_size_t gz_write(state, buf, len)
229
238
  do {
230
239
  unsigned n = (unsigned)-1;
231
240
  if (n > len)
232
- n = len;
241
+ n = (unsigned)len;
233
242
  state->strm.avail_in = n;
234
243
  state->x.pos += n;
235
244
  if (gz_comp(state, Z_NO_FLUSH) == -1)
@@ -349,12 +358,11 @@ int ZEXPORT gzputc(file, c)
349
358
  }
350
359
 
351
360
  /* -- see zlib.h -- */
352
- int ZEXPORT gzputs(file, str)
361
+ int ZEXPORT gzputs(file, s)
353
362
  gzFile file;
354
- const char *str;
363
+ const char *s;
355
364
  {
356
- int ret;
357
- z_size_t len;
365
+ z_size_t len, put;
358
366
  gz_statep state;
359
367
 
360
368
  /* get internal structure */
@@ -367,9 +375,13 @@ int ZEXPORT gzputs(file, str)
367
375
  return -1;
368
376
 
369
377
  /* write string */
370
- len = strlen(str);
371
- ret = gz_write(state, str, len);
372
- return ret == 0 && len != 0 ? -1 : ret;
378
+ len = strlen(s);
379
+ if ((int)len < 0 || (unsigned)len != len) {
380
+ gz_error(state, Z_STREAM_ERROR, "string length does not fit in int");
381
+ return -1;
382
+ }
383
+ put = gz_write(state, s, len);
384
+ return put < len ? -1 : (int)len;
373
385
  }
374
386
 
375
387
  #if defined(STDC) || defined(Z_HAVE_STDARG_H)
@@ -441,7 +453,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
441
453
  strm->avail_in = state->size;
442
454
  if (gz_comp(state, Z_NO_FLUSH) == -1)
443
455
  return state->err;
444
- memcpy(state->in, state->in + state->size, left);
456
+ memmove(state->in, state->in + state->size, left);
445
457
  strm->next_in = state->in;
446
458
  strm->avail_in = left;
447
459
  }
@@ -540,7 +552,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
540
552
  strm->avail_in = state->size;
541
553
  if (gz_comp(state, Z_NO_FLUSH) == -1)
542
554
  return state->err;
543
- memcpy(state->in, state->in + state->size, left);
555
+ memmove(state->in, state->in + state->size, left);
544
556
  strm->next_in = state->in;
545
557
  strm->avail_in = left;
546
558
  }
@@ -1,5 +1,5 @@
1
1
  /* infback.c -- inflate using a call-back interface
2
- * Copyright (C) 1995-2016 Mark Adler
2
+ * Copyright (C) 1995-2022 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -477,6 +477,7 @@ void FAR *out_desc;
477
477
  }
478
478
  Tracev((stderr, "inflate: codes ok\n"));
479
479
  state->mode = LEN;
480
+ /* fallthrough */
480
481
 
481
482
  case LEN:
482
483
  /* use inflate_fast() if we have enough input and output */
@@ -70,7 +70,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
70
70
  code const FAR *dcode; /* local strm->distcode */
71
71
  unsigned lmask; /* mask for first level of length codes */
72
72
  unsigned dmask; /* mask for first level of distance codes */
73
- code here; /* retrieved table entry */
73
+ code const *here; /* retrieved table entry */
74
74
  unsigned op; /* code bits, operation, extra bits, or */
75
75
  /* window position, window bytes to copy */
76
76
  unsigned len; /* match length, unused bytes */
@@ -107,20 +107,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
107
107
  hold += (unsigned long)(*in++) << bits;
108
108
  bits += 8;
109
109
  }
110
- here = lcode[hold & lmask];
110
+ here = lcode + (hold & lmask);
111
111
  dolen:
112
- op = (unsigned)(here.bits);
112
+ op = (unsigned)(here->bits);
113
113
  hold >>= op;
114
114
  bits -= op;
115
- op = (unsigned)(here.op);
115
+ op = (unsigned)(here->op);
116
116
  if (op == 0) { /* literal */
117
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
117
+ Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
118
118
  "inflate: literal '%c'\n" :
119
- "inflate: literal 0x%02x\n", here.val));
120
- *out++ = (unsigned char)(here.val);
119
+ "inflate: literal 0x%02x\n", here->val));
120
+ *out++ = (unsigned char)(here->val);
121
121
  }
122
122
  else if (op & 16) { /* length base */
123
- len = (unsigned)(here.val);
123
+ len = (unsigned)(here->val);
124
124
  op &= 15; /* number of extra bits */
125
125
  if (op) {
126
126
  if (bits < op) {
@@ -138,14 +138,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
138
138
  hold += (unsigned long)(*in++) << bits;
139
139
  bits += 8;
140
140
  }
141
- here = dcode[hold & dmask];
141
+ here = dcode + (hold & dmask);
142
142
  dodist:
143
- op = (unsigned)(here.bits);
143
+ op = (unsigned)(here->bits);
144
144
  hold >>= op;
145
145
  bits -= op;
146
- op = (unsigned)(here.op);
146
+ op = (unsigned)(here->op);
147
147
  if (op & 16) { /* distance base */
148
- dist = (unsigned)(here.val);
148
+ dist = (unsigned)(here->val);
149
149
  op &= 15; /* number of extra bits */
150
150
  if (bits < op) {
151
151
  hold += (unsigned long)(*in++) << bits;
@@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
264
264
  }
265
265
  }
266
266
  else if ((op & 64) == 0) { /* 2nd level distance code */
267
- here = dcode[here.val + (hold & ((1U << op) - 1))];
267
+ here = dcode + here->val + (hold & ((1U << op) - 1));
268
268
  goto dodist;
269
269
  }
270
270
  else {
@@ -274,7 +274,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
274
274
  }
275
275
  }
276
276
  else if ((op & 64) == 0) { /* 2nd level length code */
277
- here = lcode[here.val + (hold & ((1U << op) - 1))];
277
+ here = lcode + here->val + (hold & ((1U << op) - 1));
278
278
  goto dolen;
279
279
  }
280
280
  else if (op & 32) { /* end-of-block */