Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
a36a3d7f
Commit
a36a3d7f
authored
Nov 13, 2017
by
Rodger Combs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/tls_securetransport: handle incomplete reads gracefully
Signed-off-by: Aman Gupta <aman at tmm1.net>
parent
e7e7d56a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
tls_securetransport.c
libavformat/tls_securetransport.c
+16
-8
No files found.
libavformat/tls_securetransport.c
View file @
a36a3d7f
...
...
@@ -54,7 +54,7 @@ static int print_tls_error(URLContext *h, int ret)
TLSContext
*
c
=
h
->
priv_data
;
switch
(
ret
)
{
case
errSSLWouldBlock
:
break
;
return
AVERROR
(
EAGAIN
)
;
case
errSSLXCertChainInvalid
:
av_log
(
h
,
AV_LOG_ERROR
,
"Invalid certificate chain
\n
"
);
return
AVERROR
(
EIO
);
...
...
@@ -197,7 +197,8 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, void *data, size_t *dat
{
URLContext
*
h
=
(
URLContext
*
)
connection
;
TLSContext
*
c
=
h
->
priv_data
;
int
read
=
ffurl_read_complete
(
c
->
tls_shared
.
tcp
,
data
,
*
dataLength
);
size_t
requested
=
*
dataLength
;
int
read
=
ffurl_read
(
c
->
tls_shared
.
tcp
,
data
,
requested
);
if
(
read
<=
0
)
{
*
dataLength
=
0
;
switch
(
AVUNERROR
(
read
))
{
...
...
@@ -214,7 +215,10 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, void *data, size_t *dat
}
}
else
{
*
dataLength
=
read
;
return
noErr
;
if
(
read
<
requested
)
return
errSSLWouldBlock
;
else
return
noErr
;
}
}
...
...
@@ -326,12 +330,13 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
if
(
peerTrust
)
CFRelease
(
peerTrust
);
}
if
(
status
==
noErr
)
if
(
status
==
noErr
)
{
break
;
av_log
(
h
,
AV_LOG_ERROR
,
"Unable to negotiate TLS/SSL session: %i
\n
"
,
(
int
)
status
);
ret
=
AVERROR
(
EIO
);
goto
fail
;
}
else
if
(
status
!=
errSSLWouldBlock
)
{
av_log
(
h
,
AV_LOG_ERROR
,
"Unable to negotiate TLS/SSL session: %i
\n
"
,
(
int
)
status
);
ret
=
AVERROR
(
EIO
);
goto
fail
;
}
}
return
0
;
...
...
@@ -348,6 +353,9 @@ static int map_ssl_error(OSStatus status, size_t processed)
case
errSSLClosedGraceful
:
case
errSSLClosedNoNotify
:
return
0
;
case
errSSLWouldBlock
:
if
(
processed
>
0
)
return
processed
;
default:
return
(
int
)
status
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment