String index out of range error when URL contains two dots - url

I have a ColdFusion 9 server which serves the following error on any ColdFusion page where the URL contains the characters .. after a / e.g. http://www.example.com/..cfm or http://www.example.com/..foo/bar.cfm :
String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:698)
at java.lang.StringBuffer.delete(StringBuffer.java:373)
at coldfusion.util.Utils.collapseDotDots(Utils.java:604)
at coldfusion.util.Utils.canonicalizeURI(Utils.java:558)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:39)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at com.seefusion.Filter.doFilter(Filter.java:49)
at com.seefusion.SeeFusion.doFilter(SeeFusion.java:1500)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
I haven't been able to reproduce this on every server I've tested, but it seems to occur on the majority. Looking at the error, it looks like it relates to part of ColdFusion rather than any ColdFusion code running on these sites. Can anyone shed any more light on this e.g. how to catch the error?

I was getting the above error and figured out that this can be handled by "Site-wide Error Handler" in ColdFusion Admin. I directed it to my 404.cfm.
Hope it helps.

Related

bad argument in call to crypto:aes_cfb_128_crypt

This is the code snippet at line 461 which is giving badarg error ,please help me solve this error guys.
ejabberd_odbc:escape(base64:encode(crypto:aes_cfb_128_encrypt(<<"abcdefghabcdefgh">>, <<"12345678abcdefgh">>, xml:element_to_binary(NewPacket)))),
Log:
bad argument in call to crypto:aes_cfb_128_crypt(<<"abcdefghabcdefgh">>, <<"12345678abcdefgh">>, <<">, true) in mod_offline:'-store_offline_msg/6-fun-2-'/2 line 225
One of the things I like about functional languages is that you generally have an easier time reproducing errors in a controlled environment. In your case, it seems like
base64:decode(XML)
is the call that's failing, so you should write
io:format("XML=~p~n", [XML]),
base64:decode(XML)
the first line will print out the contents of XML in Erlang syntax, and the second line will fail when you get to the bad input.
Once you see the string you're trying to decode, the problem will probably be obvious (it's not a string or it's not a base64 string). If it is a correctly-encoded base64 string, then you can post that problem as a StackOverflow question and get a more useful response.

Web scraping stock dividend data with F#

I am attempting to scrape stock dividend data from web pages using F# and the FSharp.Data library. An example page can be seen at http://www.nasdaq.com/symbol/ibm/dividend-history.
To request the web page, my code is setup as a simple console app as an example and is as follows:
open FSharp.Data
[<EntryPoint>]
let main argv =
let url = "http://www.nasdaq.com/symbol/ibm/dividend-history"
let result = Http.RequestString(url)
System.Console.ReadLine() |> ignore
0 // return an integer exit code
When run, the RequestString method errors with:
"An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in FSharp.Core.dll
Additional information: Length cannot be less than zero."
It looks like the page is formatted in a way to that "traditional" scraping approaches won't work. Any ideas or thoughts would be appreciated.
This is the full stacktrace I get when I run the code:
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at FSharp.Data.HttpHelpers.getAllCookiesFromHeader#671.Invoke(Int32 i, String cookiePart) in C:\Git\FSharp.Data\src\Net\Http.fs:line 675
at Microsoft.FSharp.Collections.ArrayModule.IterateIndexed[T](FSharpFunc`2 action, T[] array)
at FSharp.Data.HttpHelpers.getAllCookiesFromHeader(String header, Uri responseUri, CookieContainer cookieContainer) in C:\Git\FSharp.Data\src\Net\Http.fs:line 671
at <StartupCode$FSharp-Data>.$Http.InnerRequest#803-5.Invoke(WebResponse _arg2) in C:\Git\FSharp.Data\src\Net\Http.fs:line 803
at Microsoft.FSharp.Control.AsyncBuilderImpl.args#835-1.Invoke(a a)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](Result`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
> at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
at <StartupCode$FSI_0004>.$FSI_0004.main#() in C:\Users\helgeu.COMPODEAL\AppData\Local\Temp\~vs2B9.fsx:line 8
Stopped due to error
I think you unfortunately have stumbled upon an bug related to this cookie handling code:
https://github.com/fsharp/FSharp.Data/issues/904
<rant>
I have tried to look into that code, but it gives me a headache from the evil cut and paste of some google answer on how to handle cookies in C# and then badly translated to F#.
</rant>
Think maybe adding info to that github case might be a better option than here.

S22.Imap.BadServerResponseException - IMAP xm003 BAD [CLIENTBUG] Command syntax error

Problem with the S22.Imap:
xm003 BAD [CLIENTBUG] Command syntax error
my Search Condition from the Example:
IEnumerable<uint> uids = client.Search(SearchCondition.SentSince(new DateTime(2015, 10, 20)));
oll other SearchCondition's work fine. Pls Help.
The problem is that S22.Imap is sending an incorrectly formatted date string in the SENTSINCE search query.
Since S22.Imap is a dead project, I would recommend switching to my open source MailKit library instead.
Hope that helps.

URL contains "&" returns internal server error

http://staging.syncfusion.com/downloads/Support/DirectTrac/88838/Linq2&sql_9d7a1858.zip this is the link returns the internal server error.
Because of "Linq2&sql_9d7a1858.zip" contains & it returns the error. When tried to run it in localhost, i got the exception "A potentially dangerous Request.Path value was detected from the client (&)" in Application_Error in global.aspx, then the right action will be called and the file got download. I am using .Net 4.0 framework. I tried to put validate input false in webconfig itself and above the action, but both failed.
Can anyone give solution for this?
Thanks,
Karthik
You could exclude the & character from the list of invalid characters (<, >, *, %, :, &, \):
<httpRuntime
requestPathInvalidCharacters="<,>,*,%,:,\"
/>

Weird rails error while loading the application

I am having this bizarre error and I don't know what to do.
This code runs fine on my development and staging machine but crashes on production.
All I have to do is load the page or call script/server to trigger the following error:
Error message:
interning empty string
Exception class:
ArgumentError
Full Stack trace: Code
Sorry for this short description, but this is all that i am able to show to you. =/
Thank you.
This could be because you have an invalid filename for a partial (a filename with two consecutive zeros).
For example
_partial..html.erb (invalid)
This blog post mentions this error:
http://anaphoral.blogspot.com/2009/04/rails-interning-empty-string.html

Resources