| Line 1... |
Line 1... |
| 1 |
/*
|
1 |
/*
|
| 2 |
* R : A Computer Language for Statistical Data Analysis
|
2 |
* R : A Computer Language for Statistical Data Analysis
|
| 3 |
* Copyright (C) 2015-2018 The R Core Team
|
3 |
* Copyright (C) 2015-2019 The R Core Team
|
| 4 |
*
|
4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
| 6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
| 7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
| 8 |
* (at your option) any later version.
|
8 |
* (at your option) any later version.
|
| Line 718... |
Line 718... |
| 718 |
So we implement a buffer which holds two chunks, and when what we
|
718 |
So we implement a buffer which holds two chunks, and when what we
|
| 719 |
have is not enough we move down what it left and fetch another
|
719 |
have is not enough we move down what it left and fetch another
|
| 720 |
chunk above it. For safety, the buffer is expandable but this
|
720 |
chunk above it. For safety, the buffer is expandable but this
|
| 721 |
should not be exercised.
|
721 |
should not be exercised.
|
| 722 |
|
722 |
|
| - |
|
723 |
It seems that expanding was being done by a couple of packages and
|
| - |
|
724 |
gave a use-after-free error with libcurl 7.64.0. So initial size
|
| - |
|
725 |
increased to 16x.
|
| - |
|
726 |
|
| 723 |
An alternative design would be for consumeData to return what is
|
727 |
An alternative design would be for consumeData to return what is
|
| 724 |
available and reset current. Then rcvData would only be called on
|
728 |
available and reset current. Then rcvData would only be called on
|
| 725 |
a completely empty buffer.
|
729 |
a completely empty buffer.
|
| 726 |
*/
|
730 |
*/
|
| 727 |
|
731 |
|
| Line 938... |
Line 942... |
| 938 |
free(new->description); free(new->class); free(new);
|
942 |
free(new->description); free(new->class); free(new);
|
| 939 |
error(_("allocation of url connection failed"));
|
943 |
error(_("allocation of url connection failed"));
|
| 940 |
/* for Solaris 12.5 */ new = NULL;
|
944 |
/* for Solaris 12.5 */ new = NULL;
|
| 941 |
}
|
945 |
}
|
| 942 |
RCurlconn ctxt = (RCurlconn) new->private;
|
946 |
RCurlconn ctxt = (RCurlconn) new->private;
|
| 943 |
ctxt->bufsize = 2 * CURL_MAX_WRITE_SIZE;
|
947 |
ctxt->bufsize = 16 * CURL_MAX_WRITE_SIZE;
|
| 944 |
ctxt->buf = malloc(ctxt->bufsize);
|
948 |
ctxt->buf = malloc(ctxt->bufsize);
|
| 945 |
if (!ctxt->buf) {
|
949 |
if (!ctxt->buf) {
|
| 946 |
free(new->description); free(new->class); free(new->private);
|
950 |
free(new->description); free(new->class); free(new->private);
|
| 947 |
free(new);
|
951 |
free(new);
|
| 948 |
error(_("allocation of url connection failed"));
|
952 |
error(_("allocation of url connection failed"));
|