bitlbee/bitlbee-facebook

unexpected identifier `taNewMessage', expected value

Closed this issue · 6 comments

First noticed at 2020-10-17 at 8:51 AM MST, whenever a new message is received, the following error is shown:
Error: <data>:1:12: Parse error: unexpected identifier 'taNewMessage', expected value. bitlbee-facebook then signs off and reconnects after 5 seconds.

The message is read and placed in the channel, but due to the deconn/reconn, the channel gets polluted with status messages.

I'm using commit 5930cfec4361e52ff43a606fda5d4621e9cb607d of mbologna's docker-bitlbee repo, which references release 1.2.0 of bitlbee-facebook

I have the same probem im also using the same version but without docker.

nuxi commented

I'm also getting this. Same version but from the Debian Sid repos.

nuxi commented

bitlbee isn't the only thing affected: dequis/purple-facebook#496

nuxi commented

Its trying to decode the JSON starting 16 bytes into it. There is a thrift message prepended to all the JSON payloads and when its the 1-byte 0x00 message everything is fine. When I'm getting the crash its a 25-byte message starting with 0x28 and the code is treating it like its a 41-byte message.

I'm trying a build with #198 included to see what happens.

nuxi commented

So I think the problem is right here - https://github.com/bitlbee/bitlbee-facebook/blob/v1.2.0/facebook/facebook-api.c#L1564

This code comes from this commit - 75b3f5b

Here is the thrift protocol documentation - https://github.com/apache/thrift/blob/master/doc/specs/thrift-compact-protocol.md#struct

The plugin is treating the data as a thrift string, but its actually a thrift structure. This structure seems to arrive in one of two states:

  1. a lone stop field - which happens to do the right thing if its interpreted as a thrift string (it gets treated as a 0-byte string)
  2. a string field followed by a stop field

I've made a quick and dirty patch to see if this fixes the problem, if it does I'll clean it up and post PRs for bitlbee-facebook and purple-facebook.