Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in isTopicMatched #10

Closed
iheb-eddine opened this issue Dec 25, 2015 · 6 comments
Closed

Crash in isTopicMatched #10

iheb-eddine opened this issue Dec 25, 2015 · 6 comments

Comments

@iheb-eddine
Copy link

Hello,

I am using the AWS Iot project into an embedded C project.
Sometime when I update shadow, I got a crash on the function isTopicMatched.
When I debug the crash, I found the error on topicName parameter:

(gdb) p topicName.lenstring
$41 = {len = 8820, data = 0x0}

Am I doing something wrong or it is a bug?

Many thanks,
Iheb Eddine

@johnrotach
Copy link

Hello Iheb,

Can you provide a little more context around what you are doing? How large of a shadow update response are you expecting? You say it happens sometimes - can you give more information around when it fails?

John
AWS IoT

@iheb-eddine
Copy link
Author

Hello,

Thank you for your reply.
I am using a shadow with attributes, 2 integers and one string little than 25 chars.
Yesterday I fixed the problem by changing the values of AWS_IOT_MQTT_TX_BUF_LEN and AWS_IOT_MQTT_RX_BUF_LEN.
But with this changes, we don't solve the problem, because when we will have a big data we will have a crash again.

I debugged your source and I found the reason of the error.
It is on the function MQTTDeserialize_publish, on the file aws_mqtt_embedded_client_lib/MQTTPacket/src/MQTTDeserializePublish.c
We just need to change from:
if (!readMQTTLenString(topicName, &curdata, enddata) ||
enddata - curdata < 0) /* do we have enough data to read the protocol version byte? */
goto exit;

TO:
if (!readMQTTLenString(topicName, &curdata, enddata) ||
enddata - curdata < 0) /* do we have enough data to read the protocol version byte? */
{
rc = 0;
goto exit;
}

I still find many issues on parsing JSON by the library and disconnecting problems, shall I make an issue for each problem or can I send an email about that?

Thank you,
Iheb Eddine

@johnrotach
Copy link

Hi Iheb,

Thanks a lot for pointing out this issue and providing a fix! This bug has already been fixed in an internal branch of the MQTT client (along with other small fixes) and will make it in our next release (1.1.0). I anticipate this release to happen next week.

Please submit issues for any problems you may find. It is always appreciated!

John

@revmischa
Copy link

I had this exact same issue. Upgrading to the latest client version (and doing a clean) fixed the issue for me, it reports -28 now if the recv buffer is too small.

@chaurah
Copy link
Contributor

chaurah commented May 9, 2016

Hi @iheb-eddine,
We have also made several changes in the new v2.x release of the SDK to address this and various other issues that have been reported so far. Please download the new version and let us know if the issues you were facing are still there. Any suggestions you might have for improvement are always appreciated.

@revmischa Thank you for confirming that the issue is fixed in the 1.x branch as well.

Rahul

@chaurah chaurah closed this as completed May 9, 2016
@iheb-eddine
Copy link
Author

Hi @chaurah,
The issue is fixed on the last version.
Thank you for your support.

Regards,
Iheb Eddine

aggarw13 added a commit to aggarw13/aws-iot-device-sdk-embedded-C that referenced this issue Nov 29, 2019
…error-parsing

Update Foundry SDK to support token-based authentication for provisioning device with new requesred certificate. Also, parse client ID parameter provided by Foundry service after successful provisioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants