After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743877 - Miscalculation of length of null-terminated out array parameter
Miscalculation of length of null-terminated out array parameter
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.27.x
Other All
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-02 17:53 UTC by Philip Withnall
Modified: 2015-05-26 14:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample program (274 bytes, text/x-vala)
2015-02-02 17:53 UTC, Philip Withnall
Details
Fix of valaccodemethodcallmodule (918 bytes, text/plain)
2015-05-26 14:37 UTC, Francisco Ruiz
Details

Description Philip Withnall 2015-02-02 17:53:56 UTC
Created attachment 295964 [details]
Sample program

If I have a function which returns a null-terminated array as an out parameter (e.g. the alternates parameter of g_str_tokenize_and_fold()), the length of the returned array is calculated as -1, rather than having _vala_array_length() called on it.

Sample program attached. Both assertions should pass — for me, with Vala 0.27.1.7-1a9de, the second assertion fails.
Comment 1 Luca Bruno 2015-03-04 14:01:51 UTC
luca@cl170:~/my/vala (master)$ git show
commit e7be2626460c5de651df8f3bde7ead718d7b31aa
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Wed Mar 4 14:57:01 2015 +0100

    codegen: handle out param of null-terminated array
    
    Fixes bug 743877

This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.
Comment 2 Francisco Ruiz 2015-05-26 14:37:32 UTC
Created attachment 304016 [details]
Fix of valaccodemethodcallmodule