help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help fixing NativeMessaging host: read 32-bit message length in nati


From: guest271314
Subject: Re: Help fixing NativeMessaging host: read 32-bit message length in native byte order
Date: Sat, 24 Jun 2023 09:08:16 -0700

Excuse me. The instructions to install a Native Messaging host on Chrome or
Chromium are here
https://github.com/guest271314/native-messaging-quickjs#readme.md. The
previous link was an edit link. I've updated the README in the repository.
Cf. C, C++, Pytho, JavaScript versions to Bash version.

On Sat, Jun 24, 2023 at 8:21 AM Greg Wooledge <greg@wooledge.org> wrote:

> On Sat, Jun 24, 2023 at 08:10:39AM -0700, guest271314 wrote:
> > So, in the end, you can use something like this.
> >
> >   length=$(dd iflag=fullblock bs=4 count=1 | od -An -td4)
> >   length=$((length))      # trim leading spaces
> >   IFS= read -rN"$length" json
> >
> > That still winds up showing "Invalid byte sequence in conversion input"
> > when echo'ing the output to a file.
>
> Please show us the input.  Since it's binary, you'll need to represent
> it in some way that can fit into an e-mail body.  Perhaps a hex dump of
> the first 128 bytes or something.
>
> I'm rather curious what possible input could be an "invalid byte sequence"
> when interpreted as 32 bits that make up an integer.  Is it having the
> high bit set (meaning negative when read as a signed integer)?
>
> unicorn:~$ printf '\x00\x00\x00\x80' | od -An -td4
>  -2147483648
>
> Hmm, no, that looks all right to me.  Certainly didn't give that error.
>
> What operating system and architecture are you on, and what input are you
> using to generate this message, and which program is actually writing it?
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]