A search for new physics is performed based on events with jets and a pair of isolated, same-sign leptons. The results are obtained using a sample of proton-proton collision data collected by the CMS experiment at a centre-of-mass energy of 8TeV at the LHC, corresponding to an integrated luminosity of 19.5 fb(-1). In order to be sensitive to a wide variety of possible signals beyond the standard model, multiple search regions defined by the missing transverse energy, the hadronic energy, the number of jets and b-quark jets, and the transverse momenta of the leptons in the events are considered. No excess above the standard model background expectation is observed and constraints are set on a number of models for new physics, as well as on the same-sign top-quark pair and quadruple-top-quark production cross sections. Information on event selection efficiencies is also provided, so that the results can be used to confront an even broader class of new physics models.