rugged 0.27.2 → 0.27.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 279547b58b2ddeab2a82b3c8956db7b1ba159ad77a0bd527834ef6a6003ebe9e
4
- data.tar.gz: 1d941b494b23fd0fe8f0f36f461085a42f1a789d6cf3402ee8885f4623f57975
3
+ metadata.gz: 075b5f14d04691ea47a585c8295f594f8db17e555401d0c34afdc1b9ee998c79
4
+ data.tar.gz: 2d38ebeef1721dbcf676e00a32471f664d8d71702a7871f6a7cf9551c1929f65
5
5
  SHA512:
6
- metadata.gz: afd3f7404f9888f844e88d345b6c82afecf95c9fbbe9fc7dbb48c8c1c6c8386a14b3711fedec9aaba17357b57ad4a6cc0350e1b72ba356059f84d8343d58db55
7
- data.tar.gz: 796ead0476883663ba081ef0883d05dec3a2f8f9248327f32c998f96e6fd083329f85f6a9603a004b41a178b6c6dc13e0b463c75f19cd4d52fdf3874254cb07f
6
+ metadata.gz: 126a5c098f1dc094234795d8f26f4049272fdc6823e3e89a7e93afa2b6ac0583624183a0e730845e47ddfc318a3a209caac2b9af624ccce77c4e72f8ff50b8fd
7
+ data.tar.gz: 68c08ff84c4fcf0d55d8656148c605159c7582abae8f669220601e795928e571a569ddc90b7a31d1ffac31be91c19b8b8dabc41d1be5ffc51d197f1c80381c1c
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '0.27.2'
7
+ Version = VERSION = '0.27.4'
8
8
  end
@@ -7,10 +7,10 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
- #define LIBGIT2_VERSION "0.27.2"
10
+ #define LIBGIT2_VERSION "0.27.4"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
12
  #define LIBGIT2_VER_MINOR 27
13
- #define LIBGIT2_VER_REVISION 2
13
+ #define LIBGIT2_VER_REVISION 4
14
14
  #define LIBGIT2_VER_PATCH 0
15
15
 
16
16
  #define LIBGIT2_SOVERSION 27
@@ -539,10 +539,11 @@ int git_delta_apply(
539
539
  *out = NULL;
540
540
  *out_len = 0;
541
541
 
542
- /* Check that the base size matches the data we were given;
543
- * if not we would underflow while accessing data from the
544
- * base object, resulting in data corruption or segfault.
545
- */
542
+ /*
543
+ * Check that the base size matches the data we were given;
544
+ * if not we would underflow while accessing data from the
545
+ * base object, resulting in data corruption or segfault.
546
+ */
546
547
  if ((hdr_sz(&base_sz, &delta, delta_end) < 0) || (base_sz != base_len)) {
547
548
  giterr_set(GITERR_INVALID, "failed to apply delta: base size does not match given data");
548
549
  return -1;
@@ -564,31 +565,34 @@ int git_delta_apply(
564
565
  while (delta < delta_end) {
565
566
  unsigned char cmd = *delta++;
566
567
  if (cmd & 0x80) {
567
- /* cmd is a copy instruction; copy from the base.
568
- */
569
- size_t off = 0, len = 0;
570
-
571
- if (cmd & 0x01) off = *delta++;
572
- if (cmd & 0x02) off |= *delta++ << 8UL;
573
- if (cmd & 0x04) off |= *delta++ << 16UL;
574
- if (cmd & 0x08) off |= *delta++ << 24UL;
575
-
576
- if (cmd & 0x10) len = *delta++;
577
- if (cmd & 0x20) len |= *delta++ << 8UL;
578
- if (cmd & 0x40) len |= *delta++ << 16UL;
579
- if (!len) len = 0x10000;
580
-
581
- if (base_len < off + len || res_sz < len)
568
+ /* cmd is a copy instruction; copy from the base. */
569
+ size_t off = 0, len = 0, end;
570
+
571
+ #define ADD_DELTA(o, shift) { if (delta < delta_end) (o) |= ((unsigned) *delta++ << shift); else goto fail; }
572
+ if (cmd & 0x01) ADD_DELTA(off, 0UL);
573
+ if (cmd & 0x02) ADD_DELTA(off, 8UL);
574
+ if (cmd & 0x04) ADD_DELTA(off, 16UL);
575
+ if (cmd & 0x08) ADD_DELTA(off, 24UL);
576
+
577
+ if (cmd & 0x10) ADD_DELTA(len, 0UL);
578
+ if (cmd & 0x20) ADD_DELTA(len, 8UL);
579
+ if (cmd & 0x40) ADD_DELTA(len, 16UL);
580
+ if (!len) len = 0x10000;
581
+ #undef ADD_DELTA
582
+
583
+ if (GIT_ADD_SIZET_OVERFLOW(&end, off, len) ||
584
+ base_len < end || res_sz < len)
582
585
  goto fail;
586
+
583
587
  memcpy(res_dp, base + off, len);
584
588
  res_dp += len;
585
589
  res_sz -= len;
586
590
 
587
- }
588
- else if (cmd) {
589
- /* cmd is a literal insert instruction; copy from
590
- * the delta stream itself.
591
- */
591
+ } else if (cmd) {
592
+ /*
593
+ * cmd is a literal insert instruction; copy from
594
+ * the delta stream itself.
595
+ */
592
596
  if (delta_end - delta < cmd || res_sz < cmd)
593
597
  goto fail;
594
598
  memcpy(res_dp, delta, cmd);
@@ -596,10 +600,8 @@ int git_delta_apply(
596
600
  res_dp += cmd;
597
601
  res_sz -= cmd;
598
602
 
599
- }
600
- else {
601
- /* cmd == 0 is reserved for future encodings.
602
- */
603
+ } else {
604
+ /* cmd == 0 is reserved for future encodings. */
603
605
  goto fail;
604
606
  }
605
607
  }
@@ -299,8 +299,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
299
299
  pkt->ref = NULL;
300
300
  pkt->type = GIT_PKT_NG;
301
301
 
302
+ if (len < 3)
303
+ goto out_err;
302
304
  line += 3; /* skip "ng " */
303
- if (!(ptr = strchr(line, ' ')))
305
+ len -= 3;
306
+ if (!(ptr = memchr(line, ' ', len)))
304
307
  goto out_err;
305
308
  len = ptr - line;
306
309
 
@@ -311,8 +314,11 @@ static int ng_pkt(git_pkt **out, const char *line, size_t len)
311
314
  memcpy(pkt->ref, line, len);
312
315
  pkt->ref[len] = '\0';
313
316
 
317
+ if (len < 1)
318
+ goto out_err;
314
319
  line = ptr + 1;
315
- if (!(ptr = strchr(line, '\n')))
320
+ len -= 1;
321
+ if (!(ptr = memchr(line, '\n', len)))
316
322
  goto out_err;
317
323
  len = ptr - line;
318
324
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.2
4
+ version: 0.27.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-19 00:00:00.000000000 Z
12
+ date: 2018-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler