isomorphic-git 1.44.7 → 1.44.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.
package/index.cjs CHANGED
@@ -9757,13 +9757,25 @@ class GitPktLine {
9757
9757
  const reader = new StreamReader(stream);
9758
9758
  return async function read() {
9759
9759
  try {
9760
- let length = await reader.read(4);
9761
- if (length == null) return true
9762
- length = parseInt(length.toString('utf8'), 16);
9760
+ const header = await reader.read(4);
9761
+ if (header == null || header.length === 0) return true
9762
+ const hex = header.toString('utf8');
9763
+ if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
9764
+ throw new ParseError('four hexadecimal digits', hex)
9765
+ }
9766
+ const length = parseInt(hex, 16);
9763
9767
  if (length === 0) return null
9764
9768
  if (length === 1) return null // delim packets
9769
+ if (length < 4) {
9770
+ throw new ParseError('pkt-line length of 0, 1, or at least 4', hex)
9771
+ }
9765
9772
  const buffer = await reader.read(length - 4);
9766
- if (buffer == null) return true
9773
+ if (buffer == null || buffer.length !== length - 4) {
9774
+ throw new ParseError(
9775
+ `${length - 4} bytes of pkt-line data`,
9776
+ `${buffer == null ? 0 : buffer.length} bytes`
9777
+ )
9778
+ }
9767
9779
  return buffer
9768
9780
  } catch (err) {
9769
9781
  stream.error = err;
@@ -10255,8 +10267,8 @@ function filterCapabilities(server, client) {
10255
10267
 
10256
10268
  const pkg = {
10257
10269
  name: 'isomorphic-git',
10258
- version: '1.44.7',
10259
- agent: 'git/isomorphic-git@1.44.7',
10270
+ version: '1.44.8',
10271
+ agent: 'git/isomorphic-git@1.44.8',
10260
10272
  };
10261
10273
 
10262
10274
  class FIFO {
package/index.js CHANGED
@@ -9744,13 +9744,25 @@ class GitPktLine {
9744
9744
  const reader = new StreamReader(stream);
9745
9745
  return async function read() {
9746
9746
  try {
9747
- let length = await reader.read(4);
9748
- if (length == null) return true
9749
- length = parseInt(length.toString('utf8'), 16);
9747
+ const header = await reader.read(4);
9748
+ if (header == null || header.length === 0) return true
9749
+ const hex = header.toString('utf8');
9750
+ if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
9751
+ throw new ParseError('four hexadecimal digits', hex)
9752
+ }
9753
+ const length = parseInt(hex, 16);
9750
9754
  if (length === 0) return null
9751
9755
  if (length === 1) return null // delim packets
9756
+ if (length < 4) {
9757
+ throw new ParseError('pkt-line length of 0, 1, or at least 4', hex)
9758
+ }
9752
9759
  const buffer = await reader.read(length - 4);
9753
- if (buffer == null) return true
9760
+ if (buffer == null || buffer.length !== length - 4) {
9761
+ throw new ParseError(
9762
+ `${length - 4} bytes of pkt-line data`,
9763
+ `${buffer == null ? 0 : buffer.length} bytes`
9764
+ )
9765
+ }
9754
9766
  return buffer
9755
9767
  } catch (err) {
9756
9768
  stream.error = err;
@@ -10242,8 +10254,8 @@ function filterCapabilities(server, client) {
10242
10254
 
10243
10255
  const pkg = {
10244
10256
  name: 'isomorphic-git',
10245
- version: '1.44.7',
10246
- agent: 'git/isomorphic-git@1.44.7',
10257
+ version: '1.44.8',
10258
+ agent: 'git/isomorphic-git@1.44.8',
10247
10259
  };
10248
10260
 
10249
10261
  class FIFO {