14 Commits

Author SHA1 Message Date
zstein
f42cc9d8d9 Add MakeUnique from chromium and change StunMessage::AddAttribute to take a unique_ptr.
BUG=NONE

Review-Url: https://codereview.webrtc.org/2757893003
Cr-Commit-Position: refs/heads/master@{#17403}
2017-03-27 23:17:19 +00:00
zstein
ad94c4c5d9 Replace StunMessage's vector<StunAttribute*>* with a
vector<unique_ptr<StunAttribute>> as suggested in a TODO.

BUG=NONE

Review-Url: https://codereview.webrtc.org/2735523002
Cr-Commit-Position: refs/heads/master@{#17076}
2017-03-06 21:36:05 +00:00
nisse
cc99bc25d8 Change StunMessage::AddAttribute return type from bool to void.
Proper error handling was missing, using VERIFY to crash in debug
builds, while release builds would ignore the error and leak the
attribute memory. The check of attribute type consistency was changed
to a RTC_DCHECK.

Also removes a large number of uses of the deprecated VERIFY macro.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2665343002
Cr-Commit-Position: refs/heads/master@{#16413}
2017-02-02 09:31:30 +00:00
nisse
ede5da4960 Replace ASSERT by RTC_DCHECK in all non-test code.
Bulk of the changes were produced using

  git grep -l ' ASSERT(' | grep -v test | grep -v 'common\.h' |\
    xargs -n1 sed -i 's/ ASSERT(/ RTC_DCHECK(/'

followed by additional includes of base/checks.h in affected files,
and git cl format.

Also had to do some tweaks to #if !defined(NDEBUG) logic in the
taskrunner code (webrtc/base/task.cc, webrtc/base/taskparent.cc,
webrtc/base/taskparent.h, webrtc/base/taskrunner.cc), replaced to
consistently use RTC_DCHECK_IS_ON, and some of the checks needed
additional #if protection.

Test code was excluded, because it should probably use RTC_CHECK
rather than RTC_DCHECK.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2620303003
Cr-Commit-Position: refs/heads/master@{#16030}
2017-01-12 13:15:36 +00:00
Honghai Zhang
3e02430587 Fix a stun attribute leak.
In https://cs.chromium.org/chromium/src/third_party/webrtc/p2p/base/stun.cc?rcl=1474384719&l=352,
if read returned false, the created attr would not be released.

BUG=chromium:648064
R=skvlad@webrtc.org

Review URL: https://codereview.webrtc.org/2357733002 .

Cr-Commit-Position: refs/heads/master@{#14357}
2016-09-22 16:52:30 +00:00
katrielc
1a20610764 Fix buffer overflow in HMAC validation of STUN messages.
Review-Url: https://codereview.webrtc.org/2071873002
Cr-Commit-Position: refs/heads/master@{#13215}
2016-06-20 12:13:22 +00:00
katrielc
e4bda24376 Before validating a STUN packet, check it's big enough for a header.
Otherwise, we'll read out of bounds if the packet is too small.

NOTRY=true

Review-Url: https://codereview.webrtc.org/2040953003
Cr-Commit-Position: refs/heads/master@{#13093}
2016-06-09 15:45:52 +00:00
kwiberg
3ec4679dd2 Replace scoped_ptr with unique_ptr in webrtc/p2p/
But keep #including scoped_ptr.h in .h files, so as not to break
WebRTC users who expect those .h files to give them rtc::scoped_ptr.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1923163003

Cr-Commit-Position: refs/heads/master@{#12532}
2016-04-27 14:22:58 +00:00
jbauch
f1f87203d7 Split ByteBuffer into writer/reader objects.
This allows the reader to reference data, thus avoiding unnecessary
allocations and memory copies.

BUG=webrtc:5155,webrtc:5670

Review URL: https://codereview.webrtc.org/1821083002

Cr-Commit-Position: refs/heads/master@{#12160}
2016-03-30 13:43:44 +00:00
Peter Boström
0c4e06b4c6 Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.

BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

Review URL: https://codereview.webrtc.org/1362503003 .

Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 10:23:32 +00:00
pthatcher@webrtc.org
0ba1533fdb Added support for an Origin header in STUN messages.
For WebRTC there are instances where it may be desirable to provide
information to the STUN/TURN server about the website that initiated
a peer connection. This modification allows an origin string to be
included in the MediaConstraints object provided by the browser, which
is then passed as a STUN header in communications with the server.
A separate change will be submitted to the Chromium project that
uses and is dependent on this change, implementing IETF draft
http://tools.ietf.org/html/draft-johnston-tram-stun-origin-02

Originally a patch from skobalt@gmail.com.

(https://webrtc-codereview.appspot.com/12839005/edit)

R=juberti@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/41409004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8035 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-01-10 00:47:02 +00:00
henrike@webrtc.org
269fb4bc90 move xmpp and p2p to webrtc
Create a copy of talk/xmpp and talk/p2p under webrtc/libjingle/xmpp and
webrtc/p2p. Also makes libjingle use those version instead of the one in the talk folder.

BUG=3379

Review URL: https://webrtc-codereview.appspot.com/26999004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7549 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-10-28 22:20:11 +00:00
henrike@webrtc.org
28100cb388 Reverts r7459 "Create a copy of talk/xmpp and talk/p2p under webrtc/libjingle/xmpp and webrtc/p2p."
BUG=N/A
TBR=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/29829004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7472 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-10-17 22:03:39 +00:00
henrike@webrtc.org
d1ba6d9cbf Create a copy of talk/xmpp and talk/p2p under webrtc/libjingle/xmpp and webrtc/p2p.
BUG=3379
R=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/27709005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7459 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-10-15 17:30:28 +00:00