Skip to content

Conversation

@FdaSilvaYY
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY commented Nov 17, 2017

Seen by PVS-Studio analysis in #4733
I guess the test is more wrong than duplicated ;)

Should I add a test on this method OBJ_create_objects ?
Applicable to 1.1.0 and 1.0.2, backport ?

Checklist
  • documentation is added or updated
  • tests are added or updated

Copy link
Contributor

@richsalz richsalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably pick cleanly to 1.0.2

@richsalz richsalz added branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL) 1.1.0 branch: master Applies to master branch approval: review pending This pull request needs review by a committer labels Nov 17, 2017
@levitte levitte added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Nov 18, 2017
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding {} to else according to "{} in both or neither". While you're at it...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there is another one at line 730. Well, given that it reduces chances for cherry-pick it either should be separate commit (if not request), or be ignored...

@dot-asm
Copy link
Contributor

dot-asm commented Nov 19, 2017

This will probably pick cleanly to 1.0.2

Unlikely, because it reads "return (num)" instead of "return num" in master.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't check for s == NULL sufficient? At least if *o == '\0', then s will be NULL...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually formally speaking this changes behaviour and question is if original behaviour, i.e. call to OBJ_create with s being NULL is intentional. If it is, then the suggested change would actually be justified... Or in other words have you examined if OBJ_create with s being NULL is bound to fail?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is [intentional], then the suggested change would actually be justified...

I meant "unjustified".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, given the fact that in case of s being NULL OBJ_create could be called with garbage l, it's probably appropriate to assume that at least that is a bug. Yet it doesn't actually lift all concerns about original behaviour. Original code was looping till empty string was returned by BIO_gets. While suggested modification will terminate the loop at first string that doesn't meet criteria...

Copy link
Contributor Author

@FdaSilvaYY FdaSilvaYY Nov 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no error management in this corner of code, either from callers or into this called method ...
Should we silently ignore a invalid line in the middle of file ? or reject It ?
Suggestion : add code to count number of file line, and compare it to num (the oid creation counter) just before method return exit . so it may return -1 on error ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no error management in this corner of code

Which is kind of argument in favour of preserving the original behaviour at least in released branches, but probably even master [since it's meant to be minor release]. Please note that I don't have ready answer...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else { is supposed to be one line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra {} even here...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are deviating from original behaviour, then check for s == NULL is really sufficient...

Copy link
Contributor Author

@FdaSilvaYY FdaSilvaYY Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today no; I keep it for a next PR ...

@dot-asm
Copy link
Contributor

dot-asm commented Nov 21, 2017

Formally speaking this needs re-approval from original reviewers, but I suppose they can as well express it by simply committing...

Copy link
Member

@t-j-h t-j-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dot-asm feel free to merge

Pointer 'o' is set inside a local buffer, so it can't be NULL.
[extended tests]
@mattcaswell
Copy link
Member

@richsalz , @levitte or @dot-asm - is one of you going to merge this?

@richsalz
Copy link
Contributor

richsalz commented Dec 8, 2017

I'll do it now.

levitte pushed a commit that referenced this pull request Dec 8, 2017
Pointer 'o' is set inside a local buffer, so it can't be NULL.
Also fix coding style and add comments

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from #4754)
levitte pushed a commit that referenced this pull request Dec 8, 2017
Pointer 'o' is set inside a local buffer, so it can't be NULL.
Also fix coding style and add comments

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from #4754)
(cherry picked from commit cef115f)
levitte pushed a commit that referenced this pull request Dec 8, 2017
Pointer 'o' is set inside a local buffer, so it can't be NULL.
Also fix coding style and add comments

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from #4754)
(cherry picked from commit cef115f)
@richsalz
Copy link
Contributor

richsalz commented Dec 8, 2017

Merged to master, 1.0.2, 1.1.0; thank you!

@richsalz richsalz closed this Dec 8, 2017
@richsalz
Copy link
Contributor

richsalz commented Dec 8, 2017

Merged to all three branches as shown above; closing.

@FdaSilvaYY FdaSilvaYY deleted the Fix-ib-pvs branch December 8, 2017 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants