Menu

#3 Several bugs discovered by Visual Studio static code analysis

v1.0 (example)
closed
nobody
None
5
2015-12-08
2015-09-07
John Stroy
No

Using the Visual Studio static code analysis tool, I found several errors in the code. I've fixed them and attached the changes as a patch. You are welcome to (re-)license it under the terms of the MIT license (JanelLicense.txt).

1 Attachments

Discussion

  • Timothy Kil

    Timothy Kil - 2015-09-07

    Thanks John!

    I will get these changes into the next version of Janel.

    A couple questions - What version of Visual Studio did you use? And were there any extra static analysis rules you tested for other than the default list?

    Thank you,
    Tim

     
  • John Stroy

    John Stroy - 2015-09-08

    Hi Tim,

    Thanks!

    I apologize if you get a duplicate of this comment. Seems SourceForge ate my other post.

    I used Visual Studio 2013 Professional, and then switched to Visual Studio 2012 Ultimate (different host). I took the default rules, which caught issues with stack usage, unsafe functions (e.g. strtok), type conversions, string types (wide/narrow), bounds, etc. You may wish to add other rules as well, if you have access to it.

    Cheers!

     
  • Timothy Kil

    Timothy Kil - 2015-09-15

    Hi John,

    Would you zip up the files and send them to me (or just add the zip file as an attachment to this thread)?

    Thanks,
    Tim

     
  • John Stroy

    John Stroy - 2015-09-20

    Certainly. Here's the Source directory where I made the changes on top of janel-4.0.4. Please note that the .sln was upgrade to ToolsVersion="12" ("v120") and the Java SDK set to what it is on my host -- so you might not want to commit it as-is.

     
  • Timothy Kil

    Timothy Kil - 2015-09-20

    Hi John,

    When I run the unit/integration tests against your code I am getting "Unrecognized option" errors. Would you run the unit/integration tests for me on your code? To do that you would run from directory Test the batch file runtests.bat. Could you pipe the output from that to a file and attach it to this thread?

    I attached the output from runtests.bat from my local build. I am using Visual Studio 2015 Community. With Janel 4.0.4 VS 2015 Community works fine for building and integration testing.

    Thanks,
    Tim

     
  • John Stroy

    John Stroy - 2015-09-28

    Hi Tim,

    Sorry for the slow response... Things have been busy lately. I see the same problem as you when doing this on my VS2012 workstation. Let me debug it and see what went wrong.

    Thanks,

    John

     
  • John Stroy

    John Stroy - 2015-10-01

    Hi Tim,

    Can you give this patch a try? It should be applied on top of janel-4.0.4. It looks like I freed the wrong buffer, which resulted in the problem you observed. I ran the test suite on this set of changes, and it appeared to work for me, with the exception of JVM versions that I don't have installed.

    Let me know if it works for you.

    Thanks

    John

     
  • Timothy Kil

    Timothy Kil - 2015-10-02

    Thanks John!

    Would you attach your new source files to this thread zipped up?

    Thanks,
    Tim

     
  • John Stroy

    John Stroy - 2015-10-03

    Hey Tim,

    Sure thing. You can also grab it via bitbucket.

    Regards,

    John

     
  • Timothy Kil

    Timothy Kil - 2015-10-04

    Hi John,

    Your changes are now in version 4.1.0 of Janel. Thank you for your contribution!

    Tim

     
  • Timothy Kil

    Timothy Kil - 2015-12-08
    • status: open --> closed