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 129809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:50:55+00:00 2026-05-11T05:50:55+00:00

A few days ago, there were a couple questions on buffer overflow vulnerabilities (such

  • 0

A few days ago, there were a couple questions on buffer overflow vulnerabilities (such as Does Java have buffer overflows?, Secure C and the universities – trained for buffer overflow, to name a couple) which can happen in imperative programming languages such as C.

In functional programming, (from the very limited exposure I’ve had from trying out Haskell), I can see how vulnerabilities such as buffer overflow wouldn’t occur because those problems are a result of changing the state of a program or an area of memory. (Please correct me if I am wrong.)

Without accounting for the possiblity of vulnerabilities present in the compiler, interpreter or execution environment, are there any kind of security vulnerabilities that exist in the functional programming paradigm? Are there any specific types of vulnerabilities that exist in functional programming but not in imperative programming?

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T05:50:55+00:00Added an answer on May 11, 2026 at 5:50 am

    If the programmer doesn’t anticipate that [some input] could cause [program] to consume more-than-available resources, that’s a vulnerability in the form of a possible DoS. This is a weakness of all Turing-complete languages I’ve seen, but Haskell’s laziness makes it harder to reason about what a computation involves.

    As a (rather contrived) example,

    import Control.Monad (when) import System (getArgs) main = do     files <- getArgs     contents <- mapM readFile files     flip mapM_ (zip files contents) $ \(file, content) ->         when (null content) $ putStrLn $ file ++ ' is empty' 

    The naïve programmer may think, ‘Haskell is lazy, so it won’t open and read the files until it needs to’, and ‘Haskell is garbage collected, so once it’s done with a file, it can close the file handle’. Unfortunately, this program actually will just open lots of files all at once (implementation-specific), and only the empty files will get their filehandles closed (side-effect of implementation’s liveliness rules):

    $ ghc --make -O2 Test [1 of 1] Compiling Main             ( Test.hs, Test.o ) Linking Test ... $ strace -etrace=open,close ./Test dir/* /dev/null ... open('dir/1', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 3 open('dir/2', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 4 open('dir/3', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 5 open('dir/4', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 6 open('dir/5', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 7 ... open('/dev/null', O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 255 close(255) /dev/null is empty $ 

    You might not be expecting a -EMFILE ‘Too many open files’ error to ever occur.

    Like I said, this is a contrived example, and can happen in other languages too, but it’s just easier to miss certain resource usages in Haskell.

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

Sidebar

Related Questions

I just started using Kohana a couple days ago, and I have a few
Just started working with Mercurial a few days ago and there's something I don't
A few days ago, I asked why its not possible to store binary data,
I recently (a few days ago) installed .NET 3.5 SP1 and subsequently an aspnet_client
Since a few days ago, MySQL server on my Windows machine was not successful
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I
I'm using Notepad++ for python development, and few days ago I found out about
Over the last few days I have noted a few web sites that demonstrated
My site will be down for next few days. Is there any way to
Every few days VS2008 decides to get mad at me and fails to generate

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.