Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6835421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:13:49+00:00 2026-05-26T23:13:49+00:00

I’m trying to compile a bit of code that looks something like so: (examples

  • 0

I’m trying to compile a bit of code that looks something like so:
(examples starts on line 38, throw is 45)

VSShader::VSShader(_In_ ICore * const pCore, _In_ const String & path, _In_opt_ const char ** ppArgs) :
    m_Core(pCore), m_Name(path), m_DefaultTechnique(nullptr)
{
    CGcontext context = m_Core->GetCgContext();

    if (!context || !cgIsContext(context))
    {
        throw Exception(L"Voodoo/Core", L"Unable to create parameter (core has no context).", pCore, "VSShader.cpp",  __FUNCTION__  , 45);
    }

    int32_t len = m_Name.ToCharStr(0, nullptr);
    std::vector<char> buffer(len);
    path.ToCharStr(len, &buffer[0]);

    m_CgEffect = cgCreateEffectFromFile(context, &buffer[0], ppArgs);

    if (!cgIsEffect(m_CgEffect))
    {
        throw Exception(L"Voodoo/Core", L"Failed to create shader.", m_Core, "VSShader.cpp",  __FUNCTION__  , 56);
    }
    else
    {
        cgSetEffectName(m_CgEffect, &buffer[0]);
    }

    this->Link();
}

The ctor being called looks like:

Exception
(
    _In_ wchar_t * Module,
    _In_ wchar_t * Message,
    _In_opt_ ICore * pCore,
    _In_ char * File,
    _In_ char * Function,
    _In_ int Line
);

When I run analysis on this, I get the error:

1>d:\code\voodooshader\framework\core\vsshader.cpp(45): warning C6385: Invalid data: accessing ‘argument 3’, the readable size is ‘1*0’ bytes, but ‘4’ bytes might be read: Lines: 40, 39, 41, 43

As best as I can tell, that’s claiming the pointer has 0 readable bytes, and I’m trying to use 4 of those when passing it (incorrect and correct, respectively). This is a 32-bit build, so pointers should be 4 bytes.

If I change the m_Core in the throw to nullptr, I receive no errors anywhere, not just on the throw line (lines 39-41 & 43 also suddenly lack errors).

Even more unusual, if I comment out the throw entirely, I receive:

1>d:\code\voodooshader\framework\core\vsshader.cpp(56): warning C6385: Invalid data: accessing ‘argument 3’, the readable size is ‘1*0’ bytes, but ‘4’ bytes might be read: Lines: 40, 39, 41, 43, 48, 49, 50, 52, 54

This gives the same error on seemingly unrelated lines.

The MSDN example for the error appears unrelated in any meaningful way, discussing bad array access.

Is this a known error of some kind, a bug, or am I simply misreading it?

More importantly, how can I fix it (this is the only warning from the compiler or PREfast, on /w4 /wX, in an 11kloc codebase, because it loves to heap on the hateful irony :P).

Edit: After some discussion and testing, I’ve discovered two additional oddities:

If I remove the annotations entirely from the _In_ ICore* const pCore parameter, there is no error.

If I change the annotation on that parameter to _Pre_notnull_ ICore * const pCore, there is also no error. _Pre_notnull_ has most of the requirements of _In_, so this is a functional solution for the time being, but does not seem correct.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:13:50+00:00Added an answer on May 26, 2026 at 11:13 pm

    http://social.msdn.microsoft.com/forums/en-US/vstscode/thread/0505289d-4501-4f99-bc06-650c6b481566

    Visual Studio bug. Warning supression example in link above.
    It has not been fixed in VS2010 yet!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.