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

Null dereferencing, examples to small and not working. #10

Closed
Zataras opened this issue Feb 6, 2020 · 3 comments
Closed

Null dereferencing, examples to small and not working. #10

Zataras opened this issue Feb 6, 2020 · 3 comments
Labels

Comments

@Zataras
Copy link

Zataras commented Feb 6, 2020

Hi,

At hdlc_run_rx_until_read() there is no check for ( readcb != nullptr ) before calling it, so program is unexpectedly crashing when it's not initialized. It could be at least checked with assertion to help debugging.
And examples are too short, I think it's required to call at least proto.begin() to begin using proto( to avoid null dereferencing ), so why it's not mentioned in examples? They would be more helpful then.

Anyway, I'm starting to work with your library and it looks like good job.

Regards,
Zataras

@lexus2k
Copy link
Owner

lexus2k commented Feb 7, 2020

Hello, thank you for the notes. beginToSerial, which is used in examples, does the same work as begin method. You can find implementation in header files.
As for hdlc_run_rx_until_read, I can add to documentation that readcb cannot be NULL, but if you really need it to be NULL, it is ok to add verifications.
Let me know, what is the best way to your mind.

@Zataras
Copy link
Author

Zataras commented Feb 18, 2020

Hi, thanks for quick response. I'm trying to use tinyproto on Linux with usb<->uart converter. I think that predefined functions like beginToSerial are valid not for all platforms, is that right? They are also not mentioned at "Easy to use" paragraph.
With my idea of assertions - I recall this, as assertions are not platform-flexible I guess. But error code would be easy to return on nullptr.

@lexus2k
Copy link
Owner

lexus2k commented Feb 18, 2020

Hello,

Well, could you please clarify your setup? As far as understand, your setup is:

PC<->USBPort<->USB2TTLconverter<->UART<->Your device.

So, what is your device?
I found that some USB2TTL converters are not good as they should be, even if they are based on FTDI232 chip.
Next question, do you have some logic analyzer?

beginToSerial() should work for most of Arduino development boards.

@lexus2k lexus2k closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants