Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/openssl/ossl_pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
}
BIO_free(in);
if (!p7)
ossl_raise(rb_eArgError, "Could not parse the PKCS7");
ossl_raise(ePKCS7Error, "Could not parse the PKCS7");
if (!p7->d.ptr) {
PKCS7_free(p7);
ossl_raise(rb_eArgError, "No content in PKCS7");
ossl_raise(ePKCS7Error, "No content in PKCS7");
}

RTYPEDDATA_DATA(self) = p7;
Expand Down
6 changes: 6 additions & 0 deletions ext/openssl/ossl_x509cert.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
*
* Compares the two certificates. Note that this takes into account all fields,
* not just the issuer name and the serial number.
*
* This method uses X509_cmp() from OpenSSL, which compares certificates based
* on their cached DER encodings. The comparison can be unreliable if a
* certificate is incomplete.
*
* See also the man page X509_cmp(3).
*/
static VALUE
ossl_x509_eq(VALUE self, VALUE other)
Expand Down
36 changes: 18 additions & 18 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -4569,10 +4569,10 @@ primary : inline_primary
m->nd_plen = 1;
m->nd_next = $for_var;
break;
case NODE_MASGN: /* e.each {|*internal_var| a, b, c = (internal_var.length == 1 && Array === (tmp = internal_var[0]) ? tmp : internal_var); ... } */
case NODE_MASGN: /* e.each {|*internal_var| a, b, c = (internal_var.length == 1 && Array === (tmp = internal_var[0]) ? tmp : internal_var); ... } */
m->nd_next = node_assign(p, $for_var, NEW_FOR_MASGN(internal_var, &@for_var), NO_LEX_CTXT, &@for_var);
break;
default: /* e.each {|*internal_var| @a, B, c[1], d.attr = internal_val; ... } */
default: /* e.each {|*internal_var| @a, B, c[1], d.attr = internal_val; ... } */
m->nd_next = node_assign(p, (NODE *)NEW_MASGN(NEW_LIST($for_var, &@for_var), 0, &@for_var), internal_var, NO_LEX_CTXT, &@for_var);
}
/* {|*internal_id| <m> = internal_id; ... } */
Expand Down Expand Up @@ -4692,7 +4692,7 @@ primary : inline_primary
if (!p->ctxt.in_defined) {
switch (p->ctxt.in_rescue) {
case before_rescue: yyerror1(&@1, "Invalid retry without rescue"); break;
case after_rescue: /* ok */ break;
case after_rescue: /* ok */ break;
case after_else: yyerror1(&@1, "Invalid retry after else"); break;
case after_ensure: yyerror1(&@1, "Invalid retry after ensure"); break;
}
Expand Down Expand Up @@ -5122,10 +5122,10 @@ numparam : {
;

it_id : {
$$ = p->it_id;
p->it_id = 0;
}
;
$$ = p->it_id;
p->it_id = 0;
}
;

lambda : tLAMBDA[lpar]
{
Expand Down Expand Up @@ -5441,7 +5441,7 @@ p_top_expr : p_top_expr_body
}
;

p_top_expr_body : p_expr
p_top_expr_body : p_expr
| p_expr ','
{
$$ = new_array_pattern_tail(p, 0, 1, 0, 0, &@$);
Expand Down Expand Up @@ -5794,7 +5794,7 @@ p_value : p_primitive
| p_const
;

p_primitive : inline_primary
p_primitive : inline_primary
| keyword_variable
{
if (!($$ = gettable(p, $1, &@$))) $$ = NEW_ERROR(&@$);
Expand Down Expand Up @@ -6058,7 +6058,7 @@ xstring_contents: /* none */
}
;

regexp_contents: /* none */
regexp_contents : /* none */
{
$$ = 0;
/*% ripper: regexp_new! %*/
Expand Down Expand Up @@ -6205,14 +6205,14 @@ user_variable : ident_or_const
| nonlocal_var
;

keyword_variable : keyword_nil {$$ = KWD2EID(nil, $1);}
| keyword_self {$$ = KWD2EID(self, $1);}
| keyword_true {$$ = KWD2EID(true, $1);}
| keyword_false {$$ = KWD2EID(false, $1);}
| keyword__FILE__ {$$ = KWD2EID(_FILE__, $1);}
| keyword__LINE__ {$$ = KWD2EID(_LINE__, $1);}
| keyword__ENCODING__ {$$ = KWD2EID(_ENCODING__, $1);}
;
keyword_variable: keyword_nil {$$ = KWD2EID(nil, $1);}
| keyword_self {$$ = KWD2EID(self, $1);}
| keyword_true {$$ = KWD2EID(true, $1);}
| keyword_false {$$ = KWD2EID(false, $1);}
| keyword__FILE__ {$$ = KWD2EID(_FILE__, $1);}
| keyword__LINE__ {$$ = KWD2EID(_LINE__, $1);}
| keyword__ENCODING__ {$$ = KWD2EID(_ENCODING__, $1);}
;

var_ref : user_variable
{
Expand Down
4 changes: 2 additions & 2 deletions test/openssl/test_pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def test_data

def test_empty_signed_data_ruby_bug_19974
data = "-----BEGIN PKCS7-----\nMAsGCSqGSIb3DQEHAg==\n-----END PKCS7-----\n"
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(data) }
assert_raise(OpenSSL::PKCS7::PKCS7Error) { OpenSSL::PKCS7.new(data) }

data = <<END
MIME-Version: 1.0
Expand All @@ -319,7 +319,7 @@ def test_empty_signed_data_ruby_bug_19974

def test_graceful_parsing_failure #[ruby-core:43250]
contents = "not a valid PKCS #7 PEM block"
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(contents) }
assert_raise(OpenSSL::PKCS7::PKCS7Error) { OpenSSL::PKCS7.new(contents) }
end

def test_set_type_signed
Expand Down