Replace NSS with Pale Moon's

This commit is contained in:
wuggy 2026-06-29 21:29:25 +01:00
commit 8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions

View file

@ -149,7 +149,7 @@ static const char *const flag_names[] = {
};
static int /* bool */
formatKind(unsigned long kind, char *buf)
formatKind(unsigned long kind, char *buf, int space_in_buffer)
{
int i;
unsigned long k = kind & SEC_ASN1_TAGNUM_MASK;
@ -158,30 +158,30 @@ static int /* bool */
buf[0] = 0;
if ((kind & SEC_ASN1_CLASS_MASK) != SEC_ASN1_UNIVERSAL) {
sprintf(buf, " %s", class_names[(kind & SEC_ASN1_CLASS_MASK) >> 6]);
space_in_buffer -= snprintf(buf, space_in_buffer, " %s", class_names[(kind & SEC_ASN1_CLASS_MASK) >> 6]);
buf += strlen(buf);
}
if (kind & SEC_ASN1_METHOD_MASK) {
sprintf(buf, " %s", method_names[1]);
space_in_buffer -= snprintf(buf, space_in_buffer, " %s", method_names[1]);
buf += strlen(buf);
}
if ((kind & SEC_ASN1_CLASS_MASK) == SEC_ASN1_UNIVERSAL) {
if (k || !notag) {
sprintf(buf, " %s", type_names[k]);
space_in_buffer -= snprintf(buf, space_in_buffer, " %s", type_names[k]);
if ((k == SEC_ASN1_SET || k == SEC_ASN1_SEQUENCE) &&
(kind & SEC_ASN1_GROUP)) {
buf += strlen(buf);
sprintf(buf, "_OF");
space_in_buffer -= snprintf(buf, space_in_buffer, "_OF");
}
}
} else {
sprintf(buf, " [%lu]", k);
space_in_buffer -= snprintf(buf, space_in_buffer, " [%lu]", k);
}
buf += strlen(buf);
for (k = kind >> 8, i = 0; k; k >>= 1, ++i) {
if (k & 1) {
sprintf(buf, " %s", flag_names[i]);
space_in_buffer -= snprintf(buf, space_in_buffer, " %s", flag_names[i]);
buf += strlen(buf);
}
}
@ -248,7 +248,7 @@ typedef struct sec_asn1d_state_struct {
PRPackedBool
allocate, /* when true, need to allocate the destination */
endofcontents, /* this state ended up parsing end-of-contents octets */
endofcontents, /* this state ended up parsing its parent's end-of-contents octets */
explicit, /* we are handling an explicit header */
indefinite, /* the current item has indefinite-length encoding */
missing, /* an optional field that was not present */
@ -365,6 +365,11 @@ sec_asn1d_push_state(SEC_ASN1DecoderContext *cx,
state->our_mark = PORT_ArenaMark(cx->our_pool);
}
if (theTemplate == NULL) {
PORT_SetError(SEC_ERROR_BAD_TEMPLATE);
goto loser;
}
new_state = (sec_asn1d_state *)sec_asn1d_zalloc(cx->our_pool,
sizeof(*new_state));
if (new_state == NULL) {
@ -746,8 +751,9 @@ sec_asn1d_parse_identifier(sec_asn1d_state *state,
byte = (unsigned char)*buf;
#ifdef DEBUG_ASN1D_STATES
{
char kindBuf[256];
formatKind(byte, kindBuf);
int bufsize = 256;
char kindBuf[bufsize];
formatKind(byte, kindBuf, bufsize);
printf("Found tag %02x %s\n", byte, kindBuf);
}
#endif
@ -1982,8 +1988,15 @@ sec_asn1d_next_in_group(sec_asn1d_state *state)
* compensating for "offset", as is done a little farther below
* in the more normal case.
*/
PORT_Assert(state->indefinite);
PORT_Assert(state->pending == 0);
/*
* XXX We used to assert our overall state was that we were decoding
* an indefinite-length object here (state->indefinite == TRUE and no
* pending bytes in the decoder), but those assertions aren't correct
* as it's legitimate to wrap indefinite sequences inside definite ones
* and this code handles that case. Additionally, when compiled in
* release mode these assertions aren't checked anyway, yet function
* safely.
*/
if (child->dest && !state->subitems_head) {
sec_asn1d_add_to_subitems(state, child->dest, 0, PR_FALSE);
child->dest = NULL;
@ -2195,9 +2208,13 @@ sec_asn1d_next_in_sequence(sec_asn1d_state *state)
* In practice this does not happen, but for completeness
* sake it should probably be made to work at some point.
*/
PORT_Assert(child_found_tag_number < SEC_ASN1_HIGH_TAG_NUMBER);
identifier = (unsigned char)(child_found_tag_modifiers | child_found_tag_number);
sec_asn1d_record_any_header(child, (char *)&identifier, 1);
if (child_found_tag_modifiers >= SEC_ASN1_HIGH_TAG_NUMBER) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
state->top->status = decodeError;
} else {
identifier = (unsigned char)(child_found_tag_modifiers | child_found_tag_number);
sec_asn1d_record_any_header(child, (char *)&identifier, 1);
}
}
}
}
@ -2715,7 +2732,8 @@ static void
dump_states(SEC_ASN1DecoderContext *cx)
{
sec_asn1d_state *state;
char kindBuf[256];
int bufsize = 256;
char kindBuf[bufsize];
for (state = cx->current; state->parent; state = state->parent) {
;
@ -2727,7 +2745,7 @@ dump_states(SEC_ASN1DecoderContext *cx)
printf(" ");
}
i = formatKind(state->theTemplate->kind, kindBuf);
i = formatKind(state->theTemplate->kind, kindBuf, bufsize);
printf("%s: tmpl kind %s",
(state == cx->current) ? "STATE" : "State",
kindBuf);