Eneris / push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
16 stars 15 forks source link

fix infinite loop on truncated message size #12

Closed koush closed 1 year ago

koush commented 1 year ago

waitForData sets the minBytesNeeded to 0 because MCS_SIZE is a varint. since there's no constraint on that size, it immediately tries to parse again, resulting in an infinite loop.

the fix is to set the waitingForData flag again and wait for any data to come in before trying (and possibly failing) again.

koush commented 1 year ago

Issue was observed in electron.

image

Eneris commented 1 year ago

Hi. Sorry for responding so late. I am using it in Electron and have not received any such error report in production nor in development. Will keep an eye on it anyway.

For the pull request:

  1. Don;t think the change you're proposing is needed right now
  2. I see some changes in package.json that are not needed in this pull request
koush commented 1 year ago

Yeah I forked a while ago to publish the fix so it ended up including the changes from my branch.