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

  • Home
  • SEARCH
  • 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 7610143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:20:55+00:00 2026-05-31T01:20:55+00:00

after reading the data from the request as Stream i needed to convert it

  • 0

after reading the data from the request as Stream i needed to convert it to Image so i used this Method:

Stream inputStream = HttpContext.Current.Request.InputStream;
Image img = Image.FromStream(inputStream)

my question is, while im unable to know what was in that inputStream (file format is done already but still..) there may be a virus or malware, so in that case FromStream(Stream) would throw ArgumentException. since it’s not an image.

my question is – If the file uploaded contains a virus, and the method throws an exception while trying to convert the stream to Image, did that make any harm to the server?
if so, how to avoid it? what should be the scenario for handling file upload in the server?

  • 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-31T01:20:56+00:00Added an answer on May 31, 2026 at 1:20 am

    Even if we could answer this with any certainty (which we can’t, because unknown vulnerabilities are unknown, and if it was a known vulnerability, Microsoft would presumably have fixed it) it would be irresponsible to post details of an exploit here. If I knew of an attack vector via Image.FromStream (or any part of the .NET framework, or really any other way) the responsible thing to do would be to report it to the vendor (MSFT in this case) and wait for them to fix it.

    Basically, you need to trust that Microsoft has examined the edge conditions of parsing image data and ensured that there are no native buffer overflow or other similar vulnerabilities in that code. Something that Microsoft has admittedly made mistakes at in the past, but in all fairness has gotten much much better at addressing over the past few years.

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

Sidebar

Related Questions

After reading this answer: best way to pick a random subset from a collection?
After reading the tips from this great Nettuts+ article I've come up with a
After reading many related posts on this site on the subject of image comparison
After reading data from XML source I like to be able to show one
After reading this question , I was reminded of when I was taught Java
After reading this description of late static binding (LSB) I see pretty clearly what
To read data from an opened USB connection one uses UsbDeviceConnection bulkTransfer method. I
How do I read data from a file if my file is like this
I am having some trouble reading some data from a serial port I opened
I'm trying to copy some binary data from my IStream instance (since Gdiplus::Image only

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.