iodine 0.7.22 → 0.7.23

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8932b4e432bde801ae72ddb5a757e178a3fa2ca061527521c2b941d964be8920
4
- data.tar.gz: a6d6c4056060ad82e0b735aa6ebf067cbde0f5a6bda6d9a16fea1c62ba7b14df
3
+ metadata.gz: 6f79c66c0601bd9b530d826440476bb2c670c641b0d249ecef01b68d50cf3bee
4
+ data.tar.gz: 63e8eda390f1e86a2d585e8173c1681dee333b68a5efb09cda2b00e81ecda75f
5
5
  SHA512:
6
- metadata.gz: e3d3bef35a9ca6707ab14105ec5a6c6bab88cb23666be74892f6d56c3ae829a21d3bd03fee40096d891b6db147f1c1935b3c379c4e93192d15f18094e2da1760
7
- data.tar.gz: f50bd45abd3d7cecb8156912168ee265936c1a39e51d378c70ceffeab4d0c884cf8959611a1fcbeb03146b1460ec874b7164d57b636dedae5b1f505fe49b88b1
6
+ metadata.gz: e00867e6c5cf0efa7925af1cd9ee5d16869df7563b7cc9ce2c52551db679689fbfaf7b2991561ce0098bc959dacdd2e1499f26657a7d01be5e4bf056256deb38
7
+ data.tar.gz: 18c9c99f0b8d5a191f691e0945aea15244e23f49d69a182bed501655dc263e3d2c8162f994049e9ac66e3e1c8373b53540a28b68c5aebe0d4a0d0ac88383a2c2
@@ -6,6 +6,12 @@ Please notice that this change log contains changes for upcoming releases as wel
6
6
 
7
7
  ## Changes:
8
8
 
9
+ #### Change log v.0.7.23
10
+
11
+ **Fix**: (`fio`): fixed logging message for overflowing log messages. Credit to @weskerfoot (Wesley Kerfoot) and @adam12 (Adam Daniels) for exposing the issue (issue #56).
12
+
13
+ **Updates**: (`fio`) facil.io updates.
14
+
9
15
  #### Change log v.0.7.22
10
16
 
11
17
  **Fix**: (`fio`, `redis`) fixed IPC messages between redis connections (in the master process) and callback blocks (executed in the worker processes). Credit to @moxgeek (Marouane Elmidaoui) for exposing this issue (plezi#31).
@@ -9142,14 +9142,14 @@ FIO_FUNC inline void fio_str_test(void) {
9142
9142
  str = FIO_STR_INIT_STATIC("Welcome");
9143
9143
  fio_str_info_s state = fio_str_write(&str, " Home", 5);
9144
9144
  FIO_ASSERT(state.capa > 0, "Static string not converted to non-static.");
9145
- FIO_ASSERT(str.dealloc, "MIssing static string deallocation function"
9145
+ FIO_ASSERT(str.dealloc, "Missing static string deallocation function"
9146
9146
  " after `fio_str_write`.");
9147
9147
 
9148
- fprintf(stderr, "* reviewing `fio_str_detach`.\n");
9148
+ fprintf(stderr, "* reviewing `fio_str_detach`.\n (%zu): %s\n", fio_str_info(&str).len, fio_str_info(&str).data);
9149
9149
  char *cstr = fio_str_detach(&str);
9150
9150
  FIO_ASSERT(cstr, "`fio_str_detach` returned NULL");
9151
9151
  FIO_ASSERT(!memcmp(cstr, "Welcome Home\0", 13),
9152
- "`fio_str_detach` string error");
9152
+ "`fio_str_detach` string error: %s", cstr);
9153
9153
  fio_free(cstr);
9154
9154
  FIO_ASSERT(fio_str_len(&str) == 0, "`fio_str_detach` data wasn't cleared.");
9155
9155
  // fio_str_free(&str);
@@ -416,6 +416,13 @@ Logging and testing helpers
416
416
  /** Log everything, including debug messages. */
417
417
  #define FIO_LOG_LEVEL_DEBUG 5
418
418
 
419
+ #if FIO_LOG_LENGTH_LIMIT > 128
420
+ #define FIO_LOG_LENGTH_ON_STACK FIO_LOG_LENGTH_LIMIT
421
+ #define FIO_LOG_LENGTH_BORDER (FIO_LOG_LENGTH_LIMIT - 32)
422
+ #else
423
+ #define FIO_LOG_LENGTH_ON_STACK (FIO_LOG_LENGTH_LIMIT + 32)
424
+ #define FIO_LOG_LENGTH_BORDER FIO_LOG_LENGTH_LIMIT
425
+ #endif
419
426
  /** The logging level */
420
427
  int __attribute__((weak)) FIO_LOG_LEVEL;
421
428
 
@@ -423,16 +430,14 @@ int __attribute__((weak)) FIO_LOG_LEVEL;
423
430
  #define FIO_LOG_PRINT(level, ...) \
424
431
  do { \
425
432
  if (level <= FIO_LOG_LEVEL) { \
426
- char tmp___log[FIO_LOG_LENGTH_LIMIT]; \
433
+ char tmp___log[FIO_LOG_LENGTH_ON_STACK]; \
427
434
  int len___log = \
428
435
  snprintf(tmp___log, FIO_LOG_LENGTH_LIMIT - 2, __VA_ARGS__); \
429
436
  if (len___log <= 0 || len___log >= FIO_LOG_LENGTH_LIMIT - 2) { \
430
- if (len___log >= (FIO_LOG_LENGTH_LIMIT >> 2) && \
431
- (FIO_LOG_LENGTH_LIMIT >> 2) + 52 < FIO_LOG_LENGTH_LIMIT) { \
432
- fwrite(tmp___log, (FIO_LOG_LENGTH_LIMIT >> 2), 1, stderr); \
433
- memcpy(tmp___log + (FIO_LOG_LENGTH_LIMIT >> 2), \
434
- "...\nERROR: log line output too long (can't write).\n", 52); \
435
- len___log = (FIO_LOG_LENGTH_LIMIT >> 2) + 52; \
437
+ if (len___log >= FIO_LOG_LENGTH_LIMIT - 2) { \
438
+ memcpy(tmp___log + FIO_LOG_LENGTH_BORDER, \
439
+ "... (warning: truncated).", 25); \
440
+ len___log = FIO_LOG_LENGTH_BORDER + 25; \
436
441
  } else { \
437
442
  fwrite("ERROR: log output error (can't write).\n", 39, 1, stderr); \
438
443
  break; \
@@ -3871,27 +3876,32 @@ inline FIO_FUNC size_t fio_str_capa(fio_str_s *s) {
3871
3876
  * Returns the updated state of the String.
3872
3877
  *
3873
3878
  * Note: When shrinking, any existing data beyond the new size may be corrupted.
3879
+ *
3880
+ * Note: When providing a new size that is grater then the current string
3881
+ * capacity, any data that was written beyond the current (previous) size might
3882
+ * be replaced with NUL bytes.
3874
3883
  */
3875
3884
  inline FIO_FUNC fio_str_info_s fio_str_resize(fio_str_s *s, size_t size) {
3876
3885
  if (!s || s->frozen) {
3877
3886
  return fio_str_info(s);
3878
3887
  }
3879
3888
  if (s->small || !s->data) {
3880
- if (size >= FIO_STR_SMALL_CAPA) {
3881
- s->small = (uint8_t)(((FIO_STR_SMALL_CAPA << 1) | 1) & 0xFF);
3882
- fio_str_capa_assert(s, size);
3883
- goto big;
3889
+ if (size < FIO_STR_SMALL_CAPA) {
3890
+ s->small = (uint8_t)(((size << 1) | 1) & 0xFF);
3891
+ FIO_STR_SMALL_DATA(s)[size] = 0;
3892
+ return (fio_str_info_s){.capa = (FIO_STR_SMALL_CAPA - 1),
3893
+ .len = size,
3894
+ .data = FIO_STR_SMALL_DATA(s)};
3884
3895
  }
3885
- s->small = (uint8_t)(((size << 1) | 1) & 0xFF);
3886
- FIO_STR_SMALL_DATA(s)[size] = 0;
3887
- return (fio_str_info_s){.capa = (FIO_STR_SMALL_CAPA - 1),
3888
- .len = size,
3889
- .data = FIO_STR_SMALL_DATA(s)};
3896
+ s->small = (uint8_t)((((FIO_STR_SMALL_CAPA - 1) << 1) | 1) & 0xFF);
3897
+ fio_str_capa_assert(s, size);
3898
+ goto big;
3890
3899
  }
3891
3900
  if (size >= s->capa) {
3892
- s->len = s->capa;
3901
+ s->len = fio_ct_if2((uintptr_t)s->dealloc, s->capa, s->len);
3893
3902
  fio_str_capa_assert(s, size);
3894
3903
  }
3904
+
3895
3905
  big:
3896
3906
  s->len = size;
3897
3907
  s->data[size] = 0;
@@ -246,7 +246,8 @@ static void write_safe_str(FIOBJ dest, const FIOBJ str) {
246
246
  len--;
247
247
  if (added >= 48 && capa <= end + len + 64) {
248
248
  writer[end] = 0;
249
- fiobj_str_resize(dest, (end + len + 64));
249
+ fiobj_str_resize(dest, end);
250
+ fiobj_str_capa_assert(dest, (end + len + 64));
250
251
  t = fiobj_obj2cstr(dest);
251
252
  writer = (char *)t.data;
252
253
  capa = t.capa;
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.22'.freeze
2
+ VERSION = '0.7.23'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.22
4
+ version: 0.7.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-07 00:00:00.000000000 Z
11
+ date: 2019-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,7 +220,7 @@ licenses:
220
220
  - MIT
221
221
  metadata:
222
222
  allowed_push_host: https://rubygems.org
223
- post_install_message: 'Thank you for installing Iodine 0.7.22.
223
+ post_install_message: 'Thank you for installing Iodine 0.7.23.
224
224
 
225
225
  '
226
226
  rdoc_options: []