[genivi-dlt] [PATCH] All dlt_user functions return DLT_RETURN_BUFFER_FULL when, buffer full

Helwing, Lutz Lutz_Helwing at mentor.com
Fri Mar 18 11:12:28 EDT 2016

Dear DLT community,

we have found an issue with truncation of messages which do not fit into buffer or when buffer is full. Thus we would like to propose a patch that will undo the change in some way:

Commit d319ebf4d2d449d70befae0eebbdd82c19c5315f introduced new handling of the situation when writing data to the user buffer would exceed its size. This was achieved by truncating the data to fit. This solution had two problems:

1. It contained a bug which could lead to a buffer overflow when the updated arg_size gets negative (actually undefined value because it is unsigned).

2. Possibly useful data get lost with truncation.

Thus the patch changes the behaviour of the DLT library functions to return DLT_RETURN_BUFFER_FULL instead of truncating. This enables the user to trigger a send of the buffer and then trying to write the same data to the now empty buffer again so nothing is lost.

Also some tests have been implemented to test if the correct value is returned when too much data is tried to be written.

Perhaps this way of handling the "buffer full" situation is also not that brilliant. It would be nice to discuss a way to handle this more more reasonably. In the best case by the library itself?

Kind regards

Lutz Helwing
Senior Engineer

+49 (89) 57096 - 297<tel:+49%287721%294060-422>


+49 (89) 57096 - 400

<mailto:Oliver_Hartfuss at mentor.com>lutz_helwing at mentor.com<mailto:lutz_helwing at mentor.com>

[Mentor                                                    Automotive]
Mentor Graphics Development (Deutschland) GmbH
Arnulfstrasse 201
D-80634 München

Mentor Graphics Development (Deutschland) GmbH
Geschäftsführung: Dean Freed, Walter Vermijs, Shannon Wetzel
Handelsregister: Amtsgericht Freiburg i.Br., HRB 705237
Sitz der Gesellschaft: Peterzeller Straße 8, 78048 Villingen-Schwenningen
USt-Id Nummer: DE268786819

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160318/dbf10f20/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7787 bytes
Desc: image001.png
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160318/dbf10f20/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-All-dlt_user-functions-return-DLT_RETURN_BUFFER_FULL.patch
Type: text/x-patch
Size: 30983 bytes
Desc: 0001-All-dlt_user-functions-return-DLT_RETURN_BUFFER_FULL.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160318/dbf10f20/attachment.patch>

More information about the genivi-diagnostic-log-and-trace mailing list