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 564896 - gst_netaddress_get_ip[46]_address should check for correct type
gst_netaddress_get_ip[46]_address should check for correct type
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal minor
: 0.10.22
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-12-17 18:50 UTC by Andrew Feren
Modified: 2008-12-18 12:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for netaddress_[get|set]_* (2.99 KB, patch)
2008-12-17 18:52 UTC, Andrew Feren
none Details | Review
patch for netaddress_[get|set]_* (unified diff) (4.30 KB, patch)
2008-12-18 10:59 UTC, Andrew Feren
committed Details | Review

Description Andrew Feren 2008-12-17 18:50:43 UTC
Please describe the problem:
gst_netaddress_get_ip4_address
gst_netaddress_get_ip6_address

both return success even if naddr is the wrong type.

Steps to reproduce:
ask for a v4/v6 address if naddr is actually v6/v4 type.

Actual results:
the address you get back is not useful unless you make some assumptions about the implementation details.

Expected results:
gst_netaddress_get_ip4_address : should fail for v6 address
gst_netaddress_get_ip6_address : should either fail or return the v4 address as a transitional v6 address

Does this happen every time?
yes

Other information:
I have a patch to submit shortly.
patch also adds two new functions

gst_netaddress_get_address_bytes
gst_netaddress_set_address_bytes

Not strictly needed, but convenient
Comment 1 Andrew Feren 2008-12-17 18:52:09 UTC
Created attachment 124878 [details] [review]
patch for netaddress_[get|set]_*
Comment 2 Sebastian Dröge (slomo) 2008-12-18 09:39:27 UTC
I'll take a look at this later... makes sense to fail / return transitional ipv6 address IMHO.

Next time please attach your patch as unified diff (diff -u) as this is much easier to review :) Also your patch already includes the two new functions.
Comment 3 Andrew Feren 2008-12-18 10:59:52 UTC
Created attachment 124919 [details] [review]
patch for netaddress_[get|set]_* (unified diff)

Sorry about the diff.  I usually use subversion and forgot to give cvs diff the -u flag.
Comment 4 Wim Taymans 2008-12-18 12:40:04 UTC
Thanks for the patch, commited after some fixes to the return values of the new functions, indentation and the Since docs tags.

        Patch by: Andrew Feren <acferen at yahoo dot com>

        * gst-libs/gst/netbuffer/gstnetbuffer.c:
        (gst_netaddress_get_ip4_address), (gst_netaddress_get_ip6_address),
        (gst_netaddress_get_address_bytes),
        (gst_netaddress_set_address_bytes):
        * gst-libs/gst/netbuffer/gstnetbuffer.h:
        Make gst_netaddress_get_ip4_address fail for v6 addresses.
        Make gst_netaddress_get_ip6_address either fail or return the v4
        address as a transitional v6 address.
        Add two convenience functions:
        API: gst_netaddress_get_address_bytes()
        API: gst_netaddress_set_address_bytes()
        Fixes #564896.