author Pauli Tue, 11 Jul 2017 22:54:14 +0000 (08:54 +1000) committer Pauli Thu, 13 Jul 2017 21:32:58 +0000 (07:32 +1000)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3912)

@@ -102,41 +102,48 @@ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
return (0x80);
}

return (0x80);
}

+/*
+ * Decode a length field.
+ * The short form is a single byte defining a length 0 - 127.
+ * The long form is a byte 0 - 127 with the top bit set and this indicates
+ * the number of following octets that contain the length.  These octets
+ * are stored most significant digit first.
+ */
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
-    unsigned long i;
+    int i;

if (max-- < 1)
return 0;
if (*p == 0x80) {
*inf = 1;

if (max-- < 1)
return 0;
if (*p == 0x80) {
*inf = 1;
-        ret = 0;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
-        if (*(p++) & 0x80) {
-            if (max < (long)i + 1)
+        if (*p++ & 0x80) {
+            if (max < i + 1)
return 0;
return 0;
-            while (i && *p == 0) {
+            while (i > 0 && *p == 0) {
p++;
i--;
}
p++;
i--;
}
-            if (i > sizeof(long))
+            if (i > (int)sizeof(long))
return 0;
return 0;
-            while (i-- > 0) {
-                ret <<= 8L;
-                ret |= *(p++);
+            while (i > 0) {
+                ret <<= 8;
+                ret |= *p++;
+                i--;
}
}
+            if (ret > LONG_MAX)
+                return 0;
} else
ret = i;
}
} else
ret = i;
}
-    if (ret > LONG_MAX)
-        return 0;
*pp = p;
*rl = (long)ret;
return 1;
*pp = p;
*rl = (long)ret;
return 1;
{"ft_lang_label":"__label__en","ft_lang_prob":0.5532084,"math_prob":0.98070526,"size":1320,"snap":"2022-27-2022-33","text_gpt3_token_len":483,"char_repetition_ratio":0.11702128,"word_repetition_ratio":0.31690142,"special_character_ratio":0.45530304,"punctuation_ratio":0.16538462,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9888948,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-08-17T14:35:43Z\",\"WARC-Record-ID\":\"<urn:uuid:42731ff2-fa56-4d45-90a7-fb9ebd70b785>\",\"Content-Length\":\"19672\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8c1457df-d528-4c5b-a391-d042d827862e>\",\"WARC-Concurrent-To\":\"<urn:uuid:8220e729-a113-418e-a18f-d5aacc84e1fa>\",\"WARC-IP-Address\":\"194.97.150.234\",\"WARC-Target-URI\":\"https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=a9a157e74a0c6a886e593426f263f3d7359497b9;ds=sidebyside\",\"WARC-Payload-Digest\":\"sha1:ASE54EW5TFONKXGMME3GUD2AHHXRVEOF\",\"WARC-Block-Digest\":\"sha1:NHBEIOVPEVTAWCV3KYHQHFY7LAONSZZO\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-33/CC-MAIN-2022-33_segments_1659882572908.71_warc_CC-MAIN-20220817122626-20220817152626-00307.warc.gz\"}"}